From 81de95bd2801d404e25e282b128da9e9341f380f Mon Sep 17 00:00:00 2001 From: Amit Sharma <74371312+Amit91848@users.noreply.github.com> Date: Sun, 30 Mar 2025 09:47:12 +0530 Subject: [PATCH] feat: allow plain ask a question for paid users only (#20390) Co-authored-by: Keith Williams --- apps/web/lib/plain/plainChat.tsx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/apps/web/lib/plain/plainChat.tsx b/apps/web/lib/plain/plainChat.tsx index 7b85b88be7..4c6de541dc 100644 --- a/apps/web/lib/plain/plainChat.tsx +++ b/apps/web/lib/plain/plainChat.tsx @@ -87,6 +87,7 @@ const PlainChat = IS_PLAIN_CHAT_ENABLED const shouldOpenPlain = pathname === "/event-types" && searchParams?.has("openPlain"); const userEmail = session?.user?.email; + const isPaidUser = session?.user.belongsToActiveTeam || !!session?.user.org; const isAppDomain = useMemo(() => { const restrictedPathsSet = new Set( @@ -166,14 +167,6 @@ const PlainChat = IS_PLAIN_CHAT_ENABLED }, ], chatButtons: [ - { - icon: "chat", - text: "Ask a question", - threadDetails: { - labelTypeIds: ["lt_01JFJWNWAC464N8DZ6YE71YJRF"], - tierIdentifier: { externalId: data.userTier }, - }, - }, { icon: "bulb", text: "Send feedback", @@ -238,6 +231,17 @@ const PlainChat = IS_PLAIN_CHAT_ENABLED }, }; + if (isPaidUser) { + plainChatConfig.chatButtons.push({ + icon: "chat", + text: "Ask a question", + threadDetails: { + labelTypeIds: ["lt_01JFJWNWAC464N8DZ6YE71YJRF"], + tierIdentifier: { externalId: data.userTier }, + }, + }); + } + if (process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test") { window.__PLAIN_CONFIG__ = plainChatConfig; }