diff --git a/apps/formbricks-com/components/shared/FeedbackButton.tsx b/apps/formbricks-com/components/shared/FeedbackButton.tsx index 90838e7d22..929c3f6812 100644 --- a/apps/formbricks-com/components/shared/FeedbackButton.tsx +++ b/apps/formbricks-com/components/shared/FeedbackButton.tsx @@ -1,6 +1,5 @@ import clsx from "clsx"; import { usePlausible } from "next-plausible"; -import Script from "next/script"; import { useEffect, useRef, useState } from "react"; declare global { diff --git a/apps/web/src/components/FeedbackButton.tsx b/apps/web/src/components/FeedbackButton.tsx index 64fcf73789..db9c67bf87 100644 --- a/apps/web/src/components/FeedbackButton.tsx +++ b/apps/web/src/components/FeedbackButton.tsx @@ -1,5 +1,4 @@ import clsx from "clsx"; -import { useSession } from "next-auth/react"; import { useEffect, useRef, useState } from "react"; declare global { @@ -15,7 +14,6 @@ const feedbackEnabled = !!( export function FeedbackButton() { const [isOpen, setIsOpen] = useState(false); const feedbackRef = useRef(null); - const { data: session, status } = useSession(); useEffect(() => { if (feedbackEnabled) { @@ -36,28 +34,23 @@ export function FeedbackButton() { }, [feedbackRef, isOpen]); useEffect(() => { + window.formbricks = { + ...window.formbricks, + config: { + hqUrl: process.env.NEXT_PUBLIC_FORMBRICKS_URL, + formId: process.env.NEXT_PUBLIC_FORMBRICKS_FORM_ID, + divId: "formbricks-feedback-wrapper", + contact: { + name: "Matti", + position: "Co-Founder", + imgUrl: "https://avatars.githubusercontent.com/u/675065?s=128&v=4", + }, + }, + }; + // @ts-ignore import("@formbricks/feedback"); }, []); - useEffect(() => { - if (status !== "loading" && feedbackEnabled) { - window.formbricks = { - ...window.formbricks, - config: { - hqUrl: process.env.NEXT_PUBLIC_FORMBRICKS_URL, - formId: process.env.NEXT_PUBLIC_FORMBRICKS_FORM_ID, - divId: "formbricks-feedback-wrapper", - contact: { - name: "Matti", - position: "Co-Founder", - imgUrl: "https://avatars.githubusercontent.com/u/675065?s=128&v=4", - }, - customer: session?.user, - }, - }; - } - }, [status, session]); - if (!feedbackEnabled) return null; return (