From 569b19c3e176b3b05176649e8976f7b5cdb8d734 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Sat, 19 Oct 2024 09:01:36 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Revert=20to=20using=20js=20lib?= =?UTF-8?q?=20as=20peer=20dep=20for=20proper=20types=20resolving?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modals/Nextjs/InstallNextjsPackageSnippet.tsx | 2 +- .../modals/React/InstallReactPackageSnippet.tsx | 2 +- apps/docs/deploy/web/libraries/next-js.mdx | 2 +- apps/docs/deploy/web/libraries/react.mdx | 2 +- apps/landing-page/src/app/blog/react-chatbot/page.mdx | 2 +- packages/embeds/js/package.json | 2 +- packages/embeds/nextjs/README.md | 2 +- packages/embeds/nextjs/package.json | 8 ++++++-- packages/embeds/nextjs/src/index.ts | 11 ++++++++++- packages/embeds/nextjs/tsup.config.ts | 1 - packages/embeds/react/README.md | 2 +- packages/embeds/react/package.json | 11 +++++++---- packages/embeds/react/src/index.ts | 2 +- packages/embeds/react/tsup.config.ts | 1 - 14 files changed, 32 insertions(+), 18 deletions(-) diff --git a/apps/builder/src/features/publish/components/embeds/modals/Nextjs/InstallNextjsPackageSnippet.tsx b/apps/builder/src/features/publish/components/embeds/modals/Nextjs/InstallNextjsPackageSnippet.tsx index 80b6aa2e4f..c85ec4facf 100644 --- a/apps/builder/src/features/publish/components/embeds/modals/Nextjs/InstallNextjsPackageSnippet.tsx +++ b/apps/builder/src/features/publish/components/embeds/modals/Nextjs/InstallNextjsPackageSnippet.tsx @@ -3,7 +3,7 @@ import { CodeEditor } from "@/components/inputs/CodeEditor"; export const InstallNextjsPackageSnippet = () => { return ( diff --git a/apps/builder/src/features/publish/components/embeds/modals/React/InstallReactPackageSnippet.tsx b/apps/builder/src/features/publish/components/embeds/modals/React/InstallReactPackageSnippet.tsx index cf26c0e41e..50fe1712fa 100644 --- a/apps/builder/src/features/publish/components/embeds/modals/React/InstallReactPackageSnippet.tsx +++ b/apps/builder/src/features/publish/components/embeds/modals/React/InstallReactPackageSnippet.tsx @@ -3,7 +3,7 @@ import { CodeEditor } from "@/components/inputs/CodeEditor"; export const InstallReactPackageSnippet = () => { return ( diff --git a/apps/docs/deploy/web/libraries/next-js.mdx b/apps/docs/deploy/web/libraries/next-js.mdx index e67583b872..54317fbdd6 100644 --- a/apps/docs/deploy/web/libraries/next-js.mdx +++ b/apps/docs/deploy/web/libraries/next-js.mdx @@ -7,7 +7,7 @@ This lib is a convenient wrapper around the [Typebot React](./react) library. It ## Install ```bash -npm install @typebot.io/nextjs +npm install @typebot.io/js @typebot.io/nextjs ``` ## Usage diff --git a/apps/docs/deploy/web/libraries/react.mdx b/apps/docs/deploy/web/libraries/react.mdx index 44211a962b..3f0b6d293e 100644 --- a/apps/docs/deploy/web/libraries/react.mdx +++ b/apps/docs/deploy/web/libraries/react.mdx @@ -5,7 +5,7 @@ title: React ## Install ```bash -npm install @typebot.io/react +npm install @typebot.io/js @typebot.io/react ``` ## Standard diff --git a/apps/landing-page/src/app/blog/react-chatbot/page.mdx b/apps/landing-page/src/app/blog/react-chatbot/page.mdx index 058d5b2f22..11178f7264 100644 --- a/apps/landing-page/src/app/blog/react-chatbot/page.mdx +++ b/apps/landing-page/src/app/blog/react-chatbot/page.mdx @@ -120,7 +120,7 @@ Typebot is an open-source platform that makes it easy to create chatbots for Rea 4. In your React project, install **Typebot libraries**: ```bash -npm install @typebot.io/react +npm install @typebot.io/js @typebot.io/react ``` 5. Create a new component in your React app: diff --git a/packages/embeds/js/package.json b/packages/embeds/js/package.json index d95f124615..581aec63d9 100644 --- a/packages/embeds/js/package.json +++ b/packages/embeds/js/package.json @@ -1,6 +1,6 @@ { "name": "@typebot.io/js", - "version": "0.3.22", + "version": "0.3.23", "description": "Javascript library to display typebots on your website", "license": "FSL-1.1-ALv2", "type": "module", diff --git a/packages/embeds/nextjs/README.md b/packages/embeds/nextjs/README.md index 1a363e5132..05c538a302 100644 --- a/packages/embeds/nextjs/README.md +++ b/packages/embeds/nextjs/README.md @@ -1,7 +1,7 @@ ## Install ```bash -npm install @typebot.io/nextjs +npm install @typebot.io/js @typebot.io/nextjs ``` ## Standard diff --git a/packages/embeds/nextjs/package.json b/packages/embeds/nextjs/package.json index bda9c62dc2..a9ed563197 100644 --- a/packages/embeds/nextjs/package.json +++ b/packages/embeds/nextjs/package.json @@ -1,6 +1,6 @@ { "name": "@typebot.io/nextjs", - "version": "0.3.22", + "version": "0.3.23", "license": "FSL-1.1-ALv2", "description": "Convenient library to display typebots on your Next.js website", "type": "module", @@ -16,6 +16,9 @@ "dev": "tsup --watch", "build": "tsup" }, + "dependencies": { + "@typebot.io/js": "workspace:*" + }, "devDependencies": { "@typebot.io/tsconfig": "workspace:*", "@types/react": "18.2.15", @@ -26,7 +29,8 @@ }, "peerDependencies": { "react": "^16.0.0 || ^17.0.0 || ^18.0.0", - "next": "12.x || 13.x || 14.x" + "next": "12.x || 13.x || 14.x", + "@typebot.io/js": "0.3.22" }, "publishConfig": { "access": "public" diff --git a/packages/embeds/nextjs/src/index.ts b/packages/embeds/nextjs/src/index.ts index 1b0af9042f..b04b38ce74 100644 --- a/packages/embeds/nextjs/src/index.ts +++ b/packages/embeds/nextjs/src/index.ts @@ -21,4 +21,13 @@ export const Popup = dynamic( }, ); -export type * from "@typebot.io/js"; +export { + unmount, + toggle, + showPreviewMessage, + setInputValue, + setPrefilledVariables, + open, + hidePreviewMessage, + close, +} from "@typebot.io/js"; diff --git a/packages/embeds/nextjs/tsup.config.ts b/packages/embeds/nextjs/tsup.config.ts index df51902b1f..22a2e0fc0e 100644 --- a/packages/embeds/nextjs/tsup.config.ts +++ b/packages/embeds/nextjs/tsup.config.ts @@ -9,5 +9,4 @@ export default defineConfig(() => ({ banner: { js: '"use client"', }, - external: process.env.CI ? undefined : ["@typebot.io/js"], })); diff --git a/packages/embeds/react/README.md b/packages/embeds/react/README.md index 8c95be2184..d8e430f09a 100644 --- a/packages/embeds/react/README.md +++ b/packages/embeds/react/README.md @@ -1,7 +1,7 @@ ## Install ```bash -npm install @typebot.io/react +npm install @typebot.io/js @typebot.io/react ``` ## Standard diff --git a/packages/embeds/react/package.json b/packages/embeds/react/package.json index edfa99e0af..33992e6e4b 100644 --- a/packages/embeds/react/package.json +++ b/packages/embeds/react/package.json @@ -1,6 +1,6 @@ { "name": "@typebot.io/react", - "version": "0.3.22", + "version": "0.3.23", "description": "Convenient library to display typebots on your React app", "license": "FSL-1.1-ALv2", "type": "module", @@ -16,15 +16,18 @@ "dev": "tsup --watch", "build": "tsup" }, + "dependencies": { + "@typebot.io/js": "workspace:*" + }, "devDependencies": { "@typebot.io/tsconfig": "workspace:*", "@types/react": "18.2.15", "tsup": "8.3.0", - "react": "18.2.0", - "@typebot.io/js": "workspace:*" + "react": "18.2.0" }, "peerDependencies": { - "react": "^16.0.0 || ^17.0.0 || ^18.0.0" + "react": "^16.0.0 || ^17.0.0 || ^18.0.0", + "@typebot.io/js": "0.3.22" }, "publishConfig": { "access": "public" diff --git a/packages/embeds/react/src/index.ts b/packages/embeds/react/src/index.ts index f6b3a06b3c..8157aa613f 100644 --- a/packages/embeds/react/src/index.ts +++ b/packages/embeds/react/src/index.ts @@ -2,4 +2,4 @@ export { Standard } from "./Standard"; export { Bubble } from "./Bubble"; export { Popup } from "./Popup"; -export type * from "@typebot.io/js"; +export * from "@typebot.io/js"; diff --git a/packages/embeds/react/tsup.config.ts b/packages/embeds/react/tsup.config.ts index 2ab90b7efc..18a24218f4 100644 --- a/packages/embeds/react/tsup.config.ts +++ b/packages/embeds/react/tsup.config.ts @@ -6,5 +6,4 @@ export default defineConfig((options) => ({ format: "esm", platform: "browser", dts: true, - external: process.env.CI ? undefined : ["@typebot.io/js"], }));