diff --git a/apps/web/pages/settings/billing/index.tsx b/apps/web/pages/settings/billing/index.tsx
index 9bdc55573e..531bf20d5f 100644
--- a/apps/web/pages/settings/billing/index.tsx
+++ b/apps/web/pages/settings/billing/index.tsx
@@ -1,7 +1,6 @@
import { useRouter } from "next/router";
-import { useState } from "react";
-import { HelpScout, useChat } from "react-live-chat-loader";
+import { useIntercom } from "@calcom/features/ee/support/lib/intercom/useIntercom";
import { getLayout } from "@calcom/features/settings/layouts/SettingsLayout";
import { classNames } from "@calcom/lib";
import { WEBAPP_URL } from "@calcom/lib/constants";
@@ -33,15 +32,13 @@ const CtaRow = ({ title, description, className, children }: CtaRowProps) => {
const BillingView = () => {
const { t } = useLocale();
- const [, loadChat] = useChat();
- const [showChat, setShowChat] = useState(false);
+ const { open } = useIntercom();
const router = useRouter();
const returnTo = router.asPath;
const billingHref = `/api/integrations/stripepayment/portal?returnTo=${WEBAPP_URL}${returnTo}`;
const onContactSupportClick = () => {
- setShowChat(true);
- loadChat({ open: true });
+ open();
};
return (
@@ -61,7 +58,6 @@ const BillingView = () => {
{t("contact_support")}
- {showChat && }
>
);
diff --git a/packages/features/ee/support/components/HelpMenuItem.tsx b/packages/features/ee/support/components/HelpMenuItem.tsx
index fed3af9ae7..bce68c52f4 100644
--- a/packages/features/ee/support/components/HelpMenuItem.tsx
+++ b/packages/features/ee/support/components/HelpMenuItem.tsx
@@ -9,6 +9,7 @@ import { FiExternalLink, FiAlertTriangle } from "@calcom/ui/components/icon";
import { useFreshChat } from "../lib/freshchat/FreshChatProvider";
import { isFreshChatEnabled } from "../lib/freshchat/FreshChatScript";
+import { isInterComEnabled, useIntercom } from "../lib/intercom/useIntercom";
import ContactMenuItem from "./ContactMenuItem";
interface HelpMenuItemProps {
@@ -17,6 +18,7 @@ interface HelpMenuItemProps {
export default function HelpMenuItem({ onHelpItemSelect }: HelpMenuItemProps) {
const [rating, setRating] = useState(null);
+ const { open } = useIntercom();
const [comment, setComment] = useState("");
const [disableSubmit, setDisableSubmit] = useState(true);
const [active, setActive] = useState(false);
@@ -52,20 +54,7 @@ export default function HelpMenuItem({ onHelpItemSelect }: HelpMenuItemProps) {
target="_blank"
className="flex w-full px-5 py-2 pr-4 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-gray-900"
rel="noreferrer">
- {t("support_documentation")}
-
-
-
- {t("developer_documentation")}
+ {t("documentation")}
{t("contact_support")}
diff --git a/packages/features/ee/support/lib/freshchat/FreshChatScript.tsx b/packages/features/ee/support/lib/freshchat/FreshChatScript.tsx
index b85263bf91..8008d7655a 100644
--- a/packages/features/ee/support/lib/freshchat/FreshChatScript.tsx
+++ b/packages/features/ee/support/lib/freshchat/FreshChatScript.tsx
@@ -1,7 +1,9 @@
import Script from "next/script";
+import { z } from "zod";
import { trpc } from "@calcom/trpc/react";
+const nonEmptySchema = z.string().min(1);
declare global {
interface Window {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -14,7 +16,8 @@ const host = process.env.NEXT_PUBLIC_FRESHCHAT_HOST;
// eslint-disable-next-line turbo/no-undeclared-env-vars
const token = process.env.NEXT_PUBLIC_FRESHCHAT_TOKEN;
-export const isFreshChatEnabled = host !== "undefined" && token !== "undefined";
+export const isFreshChatEnabled =
+ nonEmptySchema.safeParse(host).success && nonEmptySchema.safeParse(token).success;
export default function FreshChatScript() {
const { data } = trpc.viewer.me.useQuery();
diff --git a/packages/features/ee/support/lib/intercom/IntercomMenuItem.tsx b/packages/features/ee/support/lib/intercom/IntercomMenuItem.tsx
index d541c5ab6c..51f9c75068 100644
--- a/packages/features/ee/support/lib/intercom/IntercomMenuItem.tsx
+++ b/packages/features/ee/support/lib/intercom/IntercomMenuItem.tsx
@@ -9,15 +9,14 @@ interface IntercomMenuItemProps {
export default function IntercomMenuItem(props: IntercomMenuItemProps) {
const { onHelpItemSelect } = props;
const { t } = useLocale();
- const { boot, show } = useIntercom();
+ const { open } = useIntercom();
// eslint-disable-next-line turbo/no-undeclared-env-vars
if (!process.env.NEXT_PUBLIC_INTERCOM_APP_ID) return null;
return (