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
-
-
-
-
-
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 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{" "}
-
- language
- {" "}
- to 'de'.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 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 2b17595439..0000000000
Binary files a/apps/demo/public/favicon.ico and /dev/null differ
diff --git a/apps/demo/public/fb-setup.png b/apps/demo/public/fb-setup.png
deleted file mode 100644
index 73d50516f0..0000000000
Binary files a/apps/demo/public/fb-setup.png and /dev/null differ
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={[]}
/>