feat: allow plain ask a question for paid users only (#20390)

Co-authored-by: Keith Williams <keithwillcode@gmail.com>
This commit is contained in:
Amit Sharma
2025-03-30 04:17:12 +00:00
committed by GitHub
co-authored by Keith Williams
parent d80ed07093
commit 81de95bd28
+12 -8
View File
@@ -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;
}