From bd22aaaa86644cd1c8e528c28565ff652df66067 Mon Sep 17 00:00:00 2001 From: Matti Nannt Date: Mon, 5 May 2025 21:03:54 +0200 Subject: [PATCH] chore: move js sdk and demo app to its own repository (#5668) --- .env.example | 6 +- apps/demo/.env.example | 5 - apps/demo/.eslintrc.js | 7 - apps/demo/.gitignore | 36 -- apps/demo/components/layout-app.tsx | 13 - apps/demo/components/sidebar.tsx | 65 ---- apps/demo/globals.css | 23 -- apps/demo/lib/utils.ts | 3 - apps/demo/next-env.d.ts | 5 - apps/demo/next.config.mjs | 17 - apps/demo/package.json | 28 -- apps/demo/pages/_app.tsx | 20 - apps/demo/pages/_document.tsx | 13 - apps/demo/pages/index.tsx | 359 ------------------ apps/demo/postcss.config.js | 5 - apps/demo/public/favicon.ico | Bin 15406 -> 0 bytes apps/demo/public/fb-setup.png | Bin 6332 -> 0 bytes apps/demo/public/next.svg | 1 - apps/demo/public/thirteen.svg | 1 - apps/demo/public/vercel.svg | 1 - apps/demo/tsconfig.json | 5 - .../landing/components/landing-sidebar.tsx | 2 - .../components/FormbricksClient.test.tsx | 81 ---- .../app/(app)/components/FormbricksClient.tsx | 44 --- .../components/MainNavigation.tsx | 4 +- .../[environmentId]/layout.test.tsx | 7 - .../profile/components/DeleteAccount.tsx | 2 - apps/web/app/(app)/layout.test.tsx | 16 - apps/web/app/(app)/layout.tsx | 19 +- apps/web/app/lib/formbricks.ts | 11 - apps/web/lib/constants.ts | 3 - apps/web/lib/env.ts | 8 - .../DeleteAccountModal/index.test.tsx | 8 - .../components/DeleteAccountModal/index.tsx | 3 - .../components/removed-from-organization.tsx | 2 - .../question-form-input/index.test.tsx | 4 - .../components/create-new-action-tab.test.tsx | 2 - .../ui/components/client-logout/index.tsx | 2 - .../environmentId-base-layout/index.test.tsx | 10 - .../environmentId-base-layout/index.tsx | 15 +- apps/web/package.json | 2 +- apps/web/vite.config.mts | 3 +- docker/docker-compose.yml | 4 - package.json | 1 - packages/js/.eslintrc.cjs | 7 - packages/js/.gitignore | 4 - packages/js/LICENSE | 9 - packages/js/README.md | 36 -- packages/js/package.json | 50 --- packages/js/src/index.ts | 23 -- packages/js/src/lib/load-formbricks.ts | 108 ------ packages/js/src/vite-env.d.ts | 1 - packages/js/tsconfig.json | 15 - packages/js/vite.config.ts | 23 -- pnpm-lock.yaml | 350 +---------------- turbo.json | 34 +- 56 files changed, 13 insertions(+), 1513 deletions(-) delete mode 100644 apps/demo/.env.example delete mode 100644 apps/demo/.eslintrc.js delete mode 100644 apps/demo/.gitignore delete mode 100644 apps/demo/components/layout-app.tsx delete mode 100644 apps/demo/components/sidebar.tsx delete mode 100644 apps/demo/globals.css delete mode 100644 apps/demo/lib/utils.ts delete mode 100644 apps/demo/next-env.d.ts delete mode 100644 apps/demo/next.config.mjs delete mode 100644 apps/demo/package.json delete mode 100644 apps/demo/pages/_app.tsx delete mode 100644 apps/demo/pages/_document.tsx delete mode 100644 apps/demo/pages/index.tsx delete mode 100644 apps/demo/postcss.config.js delete mode 100644 apps/demo/public/favicon.ico delete mode 100644 apps/demo/public/fb-setup.png delete mode 100644 apps/demo/public/next.svg delete mode 100644 apps/demo/public/thirteen.svg delete mode 100644 apps/demo/public/vercel.svg delete mode 100644 apps/demo/tsconfig.json delete mode 100644 apps/web/app/(app)/components/FormbricksClient.test.tsx delete mode 100644 apps/web/app/(app)/components/FormbricksClient.tsx delete mode 100644 apps/web/app/lib/formbricks.ts delete mode 100644 packages/js/.eslintrc.cjs delete mode 100644 packages/js/.gitignore delete mode 100644 packages/js/LICENSE delete mode 100644 packages/js/README.md delete mode 100644 packages/js/package.json delete mode 100644 packages/js/src/index.ts delete mode 100644 packages/js/src/lib/load-formbricks.ts delete mode 100644 packages/js/src/vite-env.d.ts delete mode 100644 packages/js/tsconfig.json delete mode 100644 packages/js/vite.config.ts diff --git a/.env.example b/.env.example index c6dbb414a5..11b4efd35a 100644 --- a/.env.example +++ b/.env.example @@ -154,10 +154,6 @@ NOTION_OAUTH_CLIENT_SECRET= STRIPE_SECRET_KEY= STRIPE_WEBHOOK_SECRET= -# Configure Formbricks usage within Formbricks -FORMBRICKS_API_HOST= -FORMBRICKS_ENVIRONMENT_ID= - # Oauth credentials for Google sheet integration GOOGLE_SHEETS_CLIENT_ID= GOOGLE_SHEETS_CLIENT_SECRET= @@ -221,4 +217,4 @@ UNKEY_ROOT_KEY= # SENTRY_AUTH_TOKEN= # Disable the user management from UI -# DISABLE_USER_MANAGEMENT \ No newline at end of file +# DISABLE_USER_MANAGEMENT=1 \ No newline at end of file diff --git a/apps/demo/.env.example b/apps/demo/.env.example deleted file mode 100644 index 90d5b7d8c8..0000000000 --- a/apps/demo/.env.example +++ /dev/null @@ -1,5 +0,0 @@ -NEXT_PUBLIC_FORMBRICKS_API_HOST=http://localhost:3000 -NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID=YOUR_ENVIRONMENT_ID - -# Copy the environment ID for the URL of your Formbricks App and -# paste it above to connect your Formbricks App with the Demo App. \ No newline at end of file diff --git a/apps/demo/.eslintrc.js b/apps/demo/.eslintrc.js deleted file mode 100644 index 63c8f7518e..0000000000 --- a/apps/demo/.eslintrc.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - extends: ["@formbricks/eslint-config/next.js"], - parserOptions: { - project: "tsconfig.json", - tsconfigRootDir: __dirname, - }, -}; diff --git a/apps/demo/.gitignore b/apps/demo/.gitignore deleted file mode 100644 index c87c9b392c..0000000000 --- a/apps/demo/.gitignore +++ /dev/null @@ -1,36 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# production -/build - -# misc -.DS_Store -*.pem - -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* -.pnpm-debug.log* - -# local env files -.env*.local - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts diff --git a/apps/demo/components/layout-app.tsx b/apps/demo/components/layout-app.tsx deleted file mode 100644 index 57703154a4..0000000000 --- a/apps/demo/components/layout-app.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { Sidebar } from "./sidebar"; - -export function LayoutApp({ children }: { children: React.ReactNode }): React.JSX.Element { - return ( -
- {/* Static sidebar for desktop */} -
- -
-
{children}
-
- ); -} diff --git a/apps/demo/components/sidebar.tsx b/apps/demo/components/sidebar.tsx deleted file mode 100644 index 4e54a63d2a..0000000000 --- a/apps/demo/components/sidebar.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import { - ClockIcon, - CogIcon, - CreditCardIcon, - FileBarChartIcon, - HelpCircleIcon, - HomeIcon, - ScaleIcon, - ShieldCheckIcon, - UsersIcon, -} from "lucide-react"; -import { classNames } from "../lib/utils"; - -const navigation = [ - { name: "Home", href: "#", icon: HomeIcon, current: true }, - { name: "History", href: "#", icon: ClockIcon, current: false }, - { name: "Balances", href: "#", icon: ScaleIcon, current: false }, - { name: "Cards", href: "#", icon: CreditCardIcon, current: false }, - { name: "Recipients", href: "#", icon: UsersIcon, current: false }, - { name: "Reports", href: "#", icon: FileBarChartIcon, current: false }, -]; -const secondaryNavigation = [ - { name: "Settings", href: "#", icon: CogIcon }, - { name: "Help", href: "#", icon: HelpCircleIcon }, - { name: "Privacy", href: "#", icon: ShieldCheckIcon }, -]; - -export function Sidebar(): React.JSX.Element { - return ( -
- -
- ); -} diff --git a/apps/demo/globals.css b/apps/demo/globals.css deleted file mode 100644 index 5098be34ec..0000000000 --- a/apps/demo/globals.css +++ /dev/null @@ -1,23 +0,0 @@ -@import 'tailwindcss'; - -@plugin '@tailwindcss/forms'; - -@custom-variant dark (&:is(.dark *)); - -/* - The default border color has changed to `currentcolor` in Tailwind CSS v4, - so we've added these compatibility styles to make sure everything still - looks the same as it did with Tailwind CSS v3. - - If we ever want to remove these styles, we need to add an explicit border - color utility to any element that depends on these defaults. -*/ -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} diff --git a/apps/demo/lib/utils.ts b/apps/demo/lib/utils.ts deleted file mode 100644 index 24e25d3d0e..0000000000 --- a/apps/demo/lib/utils.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function classNames(...classes: string[]): string { - return classes.filter(Boolean).join(" "); -} diff --git a/apps/demo/next-env.d.ts b/apps/demo/next-env.d.ts deleted file mode 100644 index 52e831b434..0000000000 --- a/apps/demo/next-env.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/// -/// - -// NOTE: This file should not be edited -// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information. diff --git a/apps/demo/next.config.mjs b/apps/demo/next.config.mjs deleted file mode 100644 index 151cc3ec71..0000000000 --- a/apps/demo/next.config.mjs +++ /dev/null @@ -1,17 +0,0 @@ -/** @type {import('next').NextConfig} */ -const nextConfig = { - images: { - remotePatterns: [ - { - protocol: "https", - hostname: "tailwindui.com", - }, - { - protocol: "https", - hostname: "images.unsplash.com", - }, - ], - }, -}; - -export default nextConfig; diff --git a/apps/demo/package.json b/apps/demo/package.json deleted file mode 100644 index fa36524ea3..0000000000 --- a/apps/demo/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "@formbricks/demo", - "version": "0.0.0", - "private": true, - "scripts": { - "clean": "rimraf .turbo node_modules .next", - "dev": "next dev -p 3002 --turbopack", - "go": "next dev -p 3002 --turbopack", - "build": "next build", - "start": "next start", - "lint": "next lint" - }, - "dependencies": { - "@formbricks/js": "workspace:*", - "@tailwindcss/forms": "0.5.9", - "@tailwindcss/postcss": "4.1.3", - "lucide-react": "0.486.0", - "next": "15.2.4", - "postcss": "8.5.3", - "react": "19.1.0", - "react-dom": "19.1.0", - "tailwindcss": "4.1.3" - }, - "devDependencies": { - "@formbricks/config-typescript": "workspace:*", - "@formbricks/eslint-config": "workspace:*" - } -} diff --git a/apps/demo/pages/_app.tsx b/apps/demo/pages/_app.tsx deleted file mode 100644 index e2ba74a494..0000000000 --- a/apps/demo/pages/_app.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import type { AppProps } from "next/app"; -import Head from "next/head"; -import "../globals.css"; - -export default function App({ Component, pageProps }: AppProps): React.JSX.Element { - return ( - <> - - Demo App - - {(!process.env.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID || - !process.env.NEXT_PUBLIC_FORMBRICKS_API_HOST) && ( -
- Please set Formbricks environment variables in apps/demo/.env -
- )} - - - ); -} diff --git a/apps/demo/pages/_document.tsx b/apps/demo/pages/_document.tsx deleted file mode 100644 index 3a10b97bee..0000000000 --- a/apps/demo/pages/_document.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { Head, Html, Main, NextScript } from "next/document"; - -export default function Document(): React.JSX.Element { - return ( - - - -
- - - - ); -} diff --git a/apps/demo/pages/index.tsx b/apps/demo/pages/index.tsx deleted file mode 100644 index 08efe8689b..0000000000 --- a/apps/demo/pages/index.tsx +++ /dev/null @@ -1,359 +0,0 @@ -import Image from "next/image"; -import { useRouter } from "next/router"; -import { useEffect, useState } from "react"; -import formbricks from "@formbricks/js"; -import fbsetup from "../public/fb-setup.png"; - -declare const window: Window; - -export default function AppPage(): React.JSX.Element { - const [darkMode, setDarkMode] = useState(false); - const router = useRouter(); - const userId = "THIS-IS-A-VERY-LONG-USER-ID-FOR-TESTING"; - const userAttributes = { - "Attribute 1": "one", - "Attribute 2": "two", - "Attribute 3": "three", - }; - - useEffect(() => { - if (darkMode) { - document.body.classList.add("dark"); - } else { - document.body.classList.remove("dark"); - } - }, [darkMode]); - - useEffect(() => { - const initFormbricks = () => { - // enable Formbricks debug mode by adding formbricksDebug=true GET parameter - const addFormbricksDebugParam = (): void => { - const urlParams = new URLSearchParams(window.location.search); - if (!urlParams.has("formbricksDebug")) { - urlParams.set("formbricksDebug", "true"); - const newUrl = `${window.location.pathname}?${urlParams.toString()}`; - window.history.replaceState({}, "", newUrl); - } - }; - - addFormbricksDebugParam(); - - if (process.env.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID && process.env.NEXT_PUBLIC_FORMBRICKS_API_HOST) { - void formbricks.setup({ - environmentId: process.env.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID, - appUrl: process.env.NEXT_PUBLIC_FORMBRICKS_API_HOST, - }); - } - - // Connect next.js router to Formbricks - if (process.env.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID && process.env.NEXT_PUBLIC_FORMBRICKS_API_HOST) { - const handleRouteChange = formbricks.registerRouteChange; - - router.events.on("routeChangeComplete", () => { - void handleRouteChange(); - }); - - return () => { - router.events.off("routeChangeComplete", () => { - void handleRouteChange(); - }); - }; - } - }; - - initFormbricks(); - }, [router.events]); - - return ( -
-
-
-
-

- Formbricks In-product Survey Demo App -

-

- This app helps you test your app surveys. You can create and test user actions, create and - update user attributes, etc. -

-
-
- - -
- -
-
-
-

1. Setup .env

-

- Copy the environment ID of your Formbricks app to the env variable in /apps/demo/.env -

- fb setup - -
-

You're connected with env:

-
- - {process.env.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID} - - - - - -
-
-
-
-

2. Widget Logs

-

- Look at the logs to understand how the widget works.{" "} - Open your browser console to see the logs. -

-
-
- -
-
-

- Set a user ID / pull data from Formbricks app -

-

- On formbricks.setUserId() the user state will be fetched from Formbricks and - the local state gets updated with the user state. -

- -

- If you made a change in Formbricks app and it does not seem to work, hit 'Reset' and - try again. -

-
- -
-
- -
-
-

- This button sends a{" "} - - No Code Action - {" "} - as long as you created it beforehand in the Formbricks App.{" "} - - Here are instructions on how to do it. - -

-
-
- -
-
- -
-
-

- This button sets the{" "} - - attribute - {" "} - 'Plan' to 'Free'. If the attribute does not exist, it creates it. -

-
-
-
-
- -
-
-

- This button sets the{" "} - - attribute - {" "} - 'Plan' to 'Paid'. If the attribute does not exist, it creates it. -

-
-
-
-
- -
-
-

- This button sets the{" "} - - user email - {" "} - 'test@web.com' -

-
-
- -
-
- -
-
-

- This button sets the{" "} - - user attributes - {" "} - to 'one', 'two', 'three'. -

-
-
- -
-
- -
-
-

- This button sets the{" "} - - language - {" "} - to 'de'. -

-
-
- -
-
- -
-
-

- This button sends a{" "} - - Code Action - {" "} - as long as you created it beforehand in the Formbricks App.{" "} - - Here are instructions on how to do it. - -

-
-
- -
-
- -
-
-

- This button logs out the user and syncs the local state with Formbricks. (Only works if a - userId is set) -

-
-
-
-
-
- ); -} diff --git a/apps/demo/postcss.config.js b/apps/demo/postcss.config.js deleted file mode 100644 index 483f378543..0000000000 --- a/apps/demo/postcss.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - plugins: { - "@tailwindcss/postcss": {}, - }, -}; diff --git a/apps/demo/public/favicon.ico b/apps/demo/public/favicon.ico deleted file mode 100644 index 2b175954392e32f653d65d5f504118593d1e2b4f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15406 zcmeHO_kUGYw$Ht}0U-e)xw$E%kp$_zh>G+sC3Fxe>b&=G90yQGAE@Af2uyiCeLCu> zAibA_k^%uj56wC{#hE|ltoQw{z4yt!H^I;NetpB|vp?tL+;jH+uDmKa`esJvS|_7v8}q_`*ELrOkhR@*WJl zA-wOK-zDf@*i{B}%jUp+w)89L%J=kl?|uJU{cb?FoM2FKZZM=Y5e(%hOXxkH@i)%x z&BOV0PRuU@i*kZB&u7VdAGDX1i?V}}J-P`-@Ni|J3@eELqmf-XroFsDABH?^zO zUXIAg^AR~(80u#JleB3AT5K6;{kcf0bX(5;HkNJ^4b1O`TTGeMko324?D}J zdppVg<5_axc&5DhdX9|hU83)jzmO4lnhhT3kypWUKg*S-@1k<$FHyPnx2Wtp8oM4nlcr#$610}8Ws-0%Cnr=xQE8ovKa%lFSNcHbxXtq_C7FU#iT z$<9L^W%sd6*>NyS{^t|WaVSd;RcFd!jLjRfiJx*%ov?Z(F4DIe~D z4t(56KH1Y*_8jRf`;K;!z2M2~|C!_QFBdx5Mde7nqD+>|&XI=Zh@8D1k=o{{T>W!Y zZv7)FcR>4H&`$cFniE&Oq|B`@s!l>Df)N#Y!R{j&a_&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V7Ei9A3~bepLzmu!5m<6B zB;fs?ks#)D|ag7Ze7Nhg)ECkldh0#vLG)-Y2|5PKJ5Shh;fw zMKV6~G(JbUbKMW(afj{ z|ACChY^>PyJ3AW*oVVO`{In*?4(vWLL;6_V%}Aw-U7$n`Zfm!=6-RAJFIFy%I>5r? z3N7pw^TlklGb<<=OYnOUYV+_OT4e)NIuU^V0RP}iMCb^5pijn3R@xBkf^w1KBkVe&g8ogGv+ixUf~RmkZ9gA74j<8jQ#co|NcAPwZgIj| zVAz-|8Xq?5R}$|P3K8k?iPEbK)8jJINL568rFFy+=k3T~DOe5!agAlFQ9=yvOjKxV z96odpMWdZ*IjXWii`$5G5WBx)pfW8JX(P#o=d@dr1QZhUDcO%@RS+NPtH~Qeq^ur` zc)va4bRA5N4L0p|pcRVd2$zgu;kXkYViXAK;Orc=xoclZs8*^&0bx5?}&S)*SN|L zEgdDhi9CPamN}+We#_IQYwMO;XPf>0r`5j@V<*v^i<=DKv61-w|09Y7fVp2CtaNwe z6ae5ZoHGWf2L9_e`WU`_4|(@4TY#<5pSJzL|L25qKNoAaWM&9pKHD4hC!Mv0y?Ldn H_x=9@J`;0! diff --git a/apps/demo/public/next.svg b/apps/demo/public/next.svg deleted file mode 100644 index 5174b28c56..0000000000 --- a/apps/demo/public/next.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/demo/public/thirteen.svg b/apps/demo/public/thirteen.svg deleted file mode 100644 index 8977c1bd12..0000000000 --- a/apps/demo/public/thirteen.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/demo/public/vercel.svg b/apps/demo/public/vercel.svg deleted file mode 100644 index d2f8422273..0000000000 --- a/apps/demo/public/vercel.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/demo/tsconfig.json b/apps/demo/tsconfig.json deleted file mode 100644 index d000509d66..0000000000 --- a/apps/demo/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "exclude": ["node_modules"], - "extends": "@formbricks/config-typescript/nextjs.json", - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"] -} diff --git a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/components/landing-sidebar.tsx b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/components/landing-sidebar.tsx index 521df03407..b6406aab4f 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/components/landing-sidebar.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/components/landing-sidebar.tsx @@ -1,6 +1,5 @@ "use client"; -import { formbricksLogout } from "@/app/lib/formbricks"; import FBLogo from "@/images/formbricks-wordmark.svg"; import { cn } from "@/lib/cn"; import { capitalizeFirstLetter } from "@/lib/utils/strings"; @@ -125,7 +124,6 @@ export const LandingSidebar = ({ { await signOut({ callbackUrl: "/auth/login" }); - await formbricksLogout(); }} icon={}> {t("common.logout")} diff --git a/apps/web/app/(app)/components/FormbricksClient.test.tsx b/apps/web/app/(app)/components/FormbricksClient.test.tsx deleted file mode 100644 index a0c67294a2..0000000000 --- a/apps/web/app/(app)/components/FormbricksClient.test.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import { render } from "@testing-library/react"; -import { describe, expect, test, vi } from "vitest"; -import formbricks from "@formbricks/js"; -import { FormbricksClient } from "./FormbricksClient"; - -// Mock next/navigation hooks. -vi.mock("next/navigation", () => ({ - usePathname: () => "/test-path", - useSearchParams: () => new URLSearchParams("foo=bar"), -})); - -// Mock the flag that enables Formbricks. -vi.mock("@/app/lib/formbricks", () => ({ - formbricksEnabled: true, -})); - -// Mock the Formbricks SDK module. -vi.mock("@formbricks/js", () => ({ - __esModule: true, - default: { - setup: vi.fn(), - setUserId: vi.fn(), - setEmail: vi.fn(), - registerRouteChange: vi.fn(), - }, -})); - -describe("FormbricksClient", () => { - test("calls setup, setUserId, setEmail and registerRouteChange on mount when enabled", () => { - const mockSetup = vi.spyOn(formbricks, "setup"); - const mockSetUserId = vi.spyOn(formbricks, "setUserId"); - const mockSetEmail = vi.spyOn(formbricks, "setEmail"); - const mockRegisterRouteChange = vi.spyOn(formbricks, "registerRouteChange"); - - render( - - ); - - // Expect the first effect to call setup and assign the provided user details. - expect(mockSetup).toHaveBeenCalledWith({ - environmentId: "env-test", - appUrl: "https://api.test.com", - }); - expect(mockSetUserId).toHaveBeenCalledWith("user-123"); - expect(mockSetEmail).toHaveBeenCalledWith("test@example.com"); - - // And the second effect should always register the route change when Formbricks is enabled. - expect(mockRegisterRouteChange).toHaveBeenCalled(); - }); - - test("does not call setup, setUserId, or setEmail if userId is not provided yet still calls registerRouteChange", () => { - const mockSetup = vi.spyOn(formbricks, "setup"); - const mockSetUserId = vi.spyOn(formbricks, "setUserId"); - const mockSetEmail = vi.spyOn(formbricks, "setEmail"); - const mockRegisterRouteChange = vi.spyOn(formbricks, "registerRouteChange"); - - render( - - ); - - // Since userId is falsy, the first effect should not call setup or assign user details. - expect(mockSetup).not.toHaveBeenCalled(); - expect(mockSetUserId).not.toHaveBeenCalled(); - expect(mockSetEmail).not.toHaveBeenCalled(); - - // The second effect only checks formbricksEnabled, so registerRouteChange should be called. - expect(mockRegisterRouteChange).toHaveBeenCalled(); - }); -}); diff --git a/apps/web/app/(app)/components/FormbricksClient.tsx b/apps/web/app/(app)/components/FormbricksClient.tsx deleted file mode 100644 index dc9a7e6ab6..0000000000 --- a/apps/web/app/(app)/components/FormbricksClient.tsx +++ /dev/null @@ -1,44 +0,0 @@ -"use client"; - -import { usePathname, useSearchParams } from "next/navigation"; -import { useEffect } from "react"; -import formbricks from "@formbricks/js"; - -interface FormbricksClientProps { - userId: string; - email: string; - formbricksEnvironmentId?: string; - formbricksApiHost?: string; - formbricksEnabled?: boolean; -} - -export const FormbricksClient = ({ - userId, - email, - formbricksEnvironmentId, - formbricksApiHost, - formbricksEnabled, -}: FormbricksClientProps) => { - const pathname = usePathname(); - const searchParams = useSearchParams(); - - useEffect(() => { - if (formbricksEnabled && userId) { - formbricks.setup({ - environmentId: formbricksEnvironmentId ?? "", - appUrl: formbricksApiHost ?? "", - }); - - formbricks.setUserId(userId); - formbricks.setEmail(email); - } - }, [userId, email, formbricksEnvironmentId, formbricksApiHost, formbricksEnabled]); - - useEffect(() => { - if (formbricksEnabled) { - formbricks.registerRouteChange(); - } - }, [pathname, searchParams, formbricksEnabled]); - - return null; -}; diff --git a/apps/web/app/(app)/environments/[environmentId]/components/MainNavigation.tsx b/apps/web/app/(app)/environments/[environmentId]/components/MainNavigation.tsx index ab68d8af3e..a1ae639a63 100644 --- a/apps/web/app/(app)/environments/[environmentId]/components/MainNavigation.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/components/MainNavigation.tsx @@ -2,7 +2,6 @@ import { getLatestStableFbReleaseAction } from "@/app/(app)/environments/[environmentId]/actions/actions"; import { NavigationLink } from "@/app/(app)/environments/[environmentId]/components/NavigationLink"; -import { formbricksLogout } from "@/app/lib/formbricks"; import FBLogo from "@/images/formbricks-wordmark.svg"; import { cn } from "@/lib/cn"; import { getAccessFlags } from "@/lib/membership/utils"; @@ -265,7 +264,7 @@ export const MainNavigation = ({ size="icon" onClick={toggleSidebar} className={cn( - "rounded-xl bg-slate-50 p-1 text-slate-600 transition-all hover:bg-slate-100 focus:ring-0 focus:ring-transparent focus:outline-none" + "rounded-xl bg-slate-50 p-1 text-slate-600 transition-all hover:bg-slate-100 focus:outline-none focus:ring-0 focus:ring-transparent" )}> {isCollapsed ? ( @@ -392,7 +391,6 @@ export const MainNavigation = ({ onClick={async () => { const route = await signOut({ redirect: false, callbackUrl: "/auth/login" }); router.push(route.url); - await formbricksLogout(); }} icon={}> {t("common.logout")} diff --git a/apps/web/app/(app)/environments/[environmentId]/layout.test.tsx b/apps/web/app/(app)/environments/[environmentId]/layout.test.tsx index 54afe41f3c..44f5ecebd1 100644 --- a/apps/web/app/(app)/environments/[environmentId]/layout.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/layout.test.tsx @@ -26,13 +26,6 @@ vi.mock("@/modules/ui/components/environmentId-base-layout", () => ({ vi.mock("@/modules/ui/components/toaster-client", () => ({ ToasterClient: () =>
, })); -vi.mock("../../components/FormbricksClient", () => ({ - FormbricksClient: ({ userId, email }: any) => ( -
- {userId}-{email} -
- ), -})); vi.mock("./components/EnvironmentStorageHandler", () => ({ default: ({ environmentId }: any) =>
{environmentId}
, })); diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/DeleteAccount.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/DeleteAccount.tsx index 2afe7f47e4..a83687403d 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/DeleteAccount.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/DeleteAccount.tsx @@ -1,6 +1,5 @@ "use client"; -import { formbricksLogout } from "@/app/lib/formbricks"; import { DeleteAccountModal } from "@/modules/account/components/DeleteAccountModal"; import { Button } from "@/modules/ui/components/button"; import { TooltipRenderer } from "@/modules/ui/components/tooltip"; @@ -37,7 +36,6 @@ export const DeleteAccount = ({ setOpen={setModalOpen} user={user} isFormbricksCloud={IS_FORMBRICKS_CLOUD} - formbricksLogout={formbricksLogout} organizationsWithSingleOwner={organizationsWithSingleOwner} />

diff --git a/apps/web/app/(app)/layout.test.tsx b/apps/web/app/(app)/layout.test.tsx index 88034a3b73..eaf82442a8 100644 --- a/apps/web/app/(app)/layout.test.tsx +++ b/apps/web/app/(app)/layout.test.tsx @@ -36,14 +36,10 @@ vi.mock("@/lib/constants", () => ({ IS_POSTHOG_CONFIGURED: true, POSTHOG_API_HOST: "test-posthog-api-host", POSTHOG_API_KEY: "test-posthog-api-key", - FORMBRICKS_API_HOST: "mock-formbricks-api-host", FORMBRICKS_ENVIRONMENT_ID: "mock-formbricks-environment-id", IS_FORMBRICKS_ENABLED: true, })); -vi.mock("@/app/(app)/components/FormbricksClient", () => ({ - FormbricksClient: () =>

, -})); vi.mock("@/app/intercom/IntercomClientWrapper", () => ({ IntercomClientWrapper: () =>
, })); @@ -74,17 +70,5 @@ describe("(app) AppLayout", () => { expect(screen.getByTestId("mock-intercom-wrapper")).toBeInTheDocument(); expect(screen.getByTestId("toaster-client")).toBeInTheDocument(); expect(screen.getByTestId("child-content")).toHaveTextContent("Hello from children"); - expect(screen.getByTestId("formbricks-client")).toBeInTheDocument(); - }); - - test("skips FormbricksClient if no user is present", async () => { - vi.mocked(getServerSession).mockResolvedValueOnce(null); - - const element = await AppLayout({ - children:
Hello from children
, - }); - render(element); - - expect(screen.queryByTestId("formbricks-client")).not.toBeInTheDocument(); }); }); diff --git a/apps/web/app/(app)/layout.tsx b/apps/web/app/(app)/layout.tsx index eef6b727c8..99339d2d8c 100644 --- a/apps/web/app/(app)/layout.tsx +++ b/apps/web/app/(app)/layout.tsx @@ -1,13 +1,5 @@ -import { FormbricksClient } from "@/app/(app)/components/FormbricksClient"; import { IntercomClientWrapper } from "@/app/intercom/IntercomClientWrapper"; -import { - FORMBRICKS_API_HOST, - FORMBRICKS_ENVIRONMENT_ID, - IS_FORMBRICKS_ENABLED, - IS_POSTHOG_CONFIGURED, - POSTHOG_API_HOST, - POSTHOG_API_KEY, -} from "@/lib/constants"; +import { IS_POSTHOG_CONFIGURED, POSTHOG_API_HOST, POSTHOG_API_KEY } from "@/lib/constants"; import { getUser } from "@/lib/user/service"; import { authOptions } from "@/modules/auth/lib/authOptions"; import { ClientLogout } from "@/modules/ui/components/client-logout"; @@ -38,15 +30,6 @@ const AppLayout = async ({ children }) => { <> - {user ? ( - - ) : null} {children} diff --git a/apps/web/app/lib/formbricks.ts b/apps/web/app/lib/formbricks.ts deleted file mode 100644 index 989022e59e..0000000000 --- a/apps/web/app/lib/formbricks.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; -import formbricks from "@formbricks/js"; - -export const formbricksLogout = async () => { - const loggedInWith = localStorage.getItem(FORMBRICKS_LOGGED_IN_WITH_LS); - localStorage.clear(); - if (loggedInWith) { - localStorage.setItem(FORMBRICKS_LOGGED_IN_WITH_LS, loggedInWith); - } - return await formbricks.logout(); -}; diff --git a/apps/web/lib/constants.ts b/apps/web/lib/constants.ts index 0130bbfc78..5e8432e13a 100644 --- a/apps/web/lib/constants.ts +++ b/apps/web/lib/constants.ts @@ -3,9 +3,6 @@ import { TUserLocale } from "@formbricks/types/user"; import { env } from "./env"; export const IS_FORMBRICKS_CLOUD = env.IS_FORMBRICKS_CLOUD === "1"; -export const FORMBRICKS_API_HOST = env.FORMBRICKS_API_HOST; -export const FORMBRICKS_ENVIRONMENT_ID = env.FORMBRICKS_ENVIRONMENT_ID; -export const IS_FORMBRICKS_ENABLED = !!(env.FORMBRICKS_API_HOST && env.FORMBRICKS_ENVIRONMENT_ID); export const IS_PRODUCTION = env.NODE_ENV === "production"; diff --git a/apps/web/lib/env.ts b/apps/web/lib/env.ts index b948666a5e..42428335b1 100644 --- a/apps/web/lib/env.ts +++ b/apps/web/lib/env.ts @@ -24,12 +24,6 @@ export const env = createEnv({ EMAIL_VERIFICATION_DISABLED: z.enum(["1", "0"]).optional(), ENCRYPTION_KEY: z.string(), ENTERPRISE_LICENSE_KEY: z.string().optional(), - FORMBRICKS_API_HOST: z - .string() - .url() - .optional() - .or(z.string().refine((str) => str === "")), - FORMBRICKS_ENVIRONMENT_ID: z.string().optional(), GITHUB_ID: z.string().optional(), GITHUB_SECRET: z.string().optional(), GOOGLE_CLIENT_ID: z.string().optional(), @@ -138,8 +132,6 @@ export const env = createEnv({ EMAIL_VERIFICATION_DISABLED: process.env.EMAIL_VERIFICATION_DISABLED, ENCRYPTION_KEY: process.env.ENCRYPTION_KEY, ENTERPRISE_LICENSE_KEY: process.env.ENTERPRISE_LICENSE_KEY, - FORMBRICKS_API_HOST: process.env.FORMBRICKS_API_HOST, - FORMBRICKS_ENVIRONMENT_ID: process.env.FORMBRICKS_ENVIRONMENT_ID, GITHUB_ID: process.env.GITHUB_ID, GITHUB_SECRET: process.env.GITHUB_SECRET, GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID, diff --git a/apps/web/modules/account/components/DeleteAccountModal/index.test.tsx b/apps/web/modules/account/components/DeleteAccountModal/index.test.tsx index 80c49f2630..fc8fbd432e 100644 --- a/apps/web/modules/account/components/DeleteAccountModal/index.test.tsx +++ b/apps/web/modules/account/components/DeleteAccountModal/index.test.tsx @@ -26,7 +26,6 @@ describe("DeleteAccountModal", () => { const mockOrgs: TOrganization[] = [{ name: "Org1" }, { name: "Org2" }] as TOrganization[]; const mockSetOpen = vi.fn(); - const mockLogout = vi.fn(); afterEach(() => { cleanup(); @@ -40,7 +39,6 @@ describe("DeleteAccountModal", () => { user={mockUser} isFormbricksCloud={false} organizationsWithSingleOwner={mockOrgs} - formbricksLogout={mockLogout} /> ); @@ -56,7 +54,6 @@ describe("DeleteAccountModal", () => { user={mockUser} isFormbricksCloud={false} organizationsWithSingleOwner={[]} - formbricksLogout={mockLogout} /> ); @@ -78,7 +75,6 @@ describe("DeleteAccountModal", () => { user={mockUser} isFormbricksCloud={false} organizationsWithSingleOwner={[]} - formbricksLogout={mockLogout} /> ); @@ -90,7 +86,6 @@ describe("DeleteAccountModal", () => { await waitFor(() => { expect(deleteUserAction).toHaveBeenCalled(); - expect(mockLogout).toHaveBeenCalled(); expect(signOut).toHaveBeenCalledWith({ callbackUrl: "/auth/login" }); expect(mockSetOpen).toHaveBeenCalledWith(false); }); @@ -114,7 +109,6 @@ describe("DeleteAccountModal", () => { user={mockUser} isFormbricksCloud={true} organizationsWithSingleOwner={[]} - formbricksLogout={mockLogout} /> ); @@ -126,7 +120,6 @@ describe("DeleteAccountModal", () => { await waitFor(() => { expect(deleteUserAction).toHaveBeenCalled(); - expect(mockLogout).toHaveBeenCalled(); expect(signOut).toHaveBeenCalledWith({ redirect: true }); expect(window.location.replace).toHaveBeenCalled(); expect(mockSetOpen).toHaveBeenCalledWith(false); @@ -143,7 +136,6 @@ describe("DeleteAccountModal", () => { user={mockUser} isFormbricksCloud={false} organizationsWithSingleOwner={[]} - formbricksLogout={mockLogout} /> ); diff --git a/apps/web/modules/account/components/DeleteAccountModal/index.tsx b/apps/web/modules/account/components/DeleteAccountModal/index.tsx index 158da36101..241c2ae90b 100644 --- a/apps/web/modules/account/components/DeleteAccountModal/index.tsx +++ b/apps/web/modules/account/components/DeleteAccountModal/index.tsx @@ -16,7 +16,6 @@ interface DeleteAccountModalProps { user: TUser; isFormbricksCloud: boolean; organizationsWithSingleOwner: TOrganization[]; - formbricksLogout: () => Promise; } export const DeleteAccountModal = ({ @@ -24,7 +23,6 @@ export const DeleteAccountModal = ({ open, user, isFormbricksCloud, - formbricksLogout, organizationsWithSingleOwner, }: DeleteAccountModalProps) => { const { t } = useTranslate(); @@ -38,7 +36,6 @@ export const DeleteAccountModal = ({ try { setDeleting(true); await deleteUserAction(); - await formbricksLogout(); // redirect to account deletion survey in Formbricks Cloud if (isFormbricksCloud) { await signOut({ redirect: true }); diff --git a/apps/web/modules/setup/organization/create/components/removed-from-organization.tsx b/apps/web/modules/setup/organization/create/components/removed-from-organization.tsx index ef91b44004..32e0ff9e1d 100644 --- a/apps/web/modules/setup/organization/create/components/removed-from-organization.tsx +++ b/apps/web/modules/setup/organization/create/components/removed-from-organization.tsx @@ -1,6 +1,5 @@ "use client"; -import { formbricksLogout } from "@/app/lib/formbricks"; import { DeleteAccountModal } from "@/modules/account/components/DeleteAccountModal"; import { Alert, AlertDescription, AlertTitle } from "@/modules/ui/components/alert"; import { Button } from "@/modules/ui/components/button"; @@ -29,7 +28,6 @@ export const RemovedFromOrganization = ({ user, isFormbricksCloud }: RemovedFrom setOpen={setIsModalOpen} user={user} isFormbricksCloud={isFormbricksCloud} - formbricksLogout={formbricksLogout} organizationsWithSingleOwner={[]} />