From 080353bffb42b30799d7e641e828649ddd6e7d61 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Mon, 2 Jan 2023 08:33:43 +0100 Subject: [PATCH] :children_crossing: Only show onboarding modal on cloud manage version Closes #173 --- apps/builder/src/components/SupportBubble.tsx | 2 +- .../features/editor/components/TypebotHeader/TypebotHeader.tsx | 2 +- apps/builder/src/features/folders/components/FolderContent.tsx | 2 ++ apps/builder/src/utils/helpers.ts | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/builder/src/components/SupportBubble.tsx b/apps/builder/src/components/SupportBubble.tsx index bb273340da0..55bd4b2c4bf 100644 --- a/apps/builder/src/components/SupportBubble.tsx +++ b/apps/builder/src/components/SupportBubble.tsx @@ -15,7 +15,7 @@ export const SupportBubble = () => { useEffect(() => { if ( - isCloudProdInstance() && + isCloudProdInstance && (localTypebotId !== typebot?.id || localUserId !== user?.id) ) { setLocalTypebotId(typebot?.id) diff --git a/apps/builder/src/features/editor/components/TypebotHeader/TypebotHeader.tsx b/apps/builder/src/features/editor/components/TypebotHeader/TypebotHeader.tsx index d8b9fdeec35..20b9b0f68ac 100644 --- a/apps/builder/src/features/editor/components/TypebotHeader/TypebotHeader.tsx +++ b/apps/builder/src/features/editor/components/TypebotHeader/TypebotHeader.tsx @@ -53,7 +53,7 @@ export const TypebotHeader = () => { } const handleHelpClick = () => { - isCloudProdInstance() + isCloudProdInstance ? getBubbleActions().open() : window.open('https://docs.typebot.io', '_blank') } diff --git a/apps/builder/src/features/folders/components/FolderContent.tsx b/apps/builder/src/features/folders/components/FolderContent.tsx index 024095cae4a..3dbf83443fe 100644 --- a/apps/builder/src/features/folders/components/FolderContent.tsx +++ b/apps/builder/src/features/folders/components/FolderContent.tsx @@ -26,6 +26,7 @@ import { CreateFolderButton } from './CreateFolderButton' import { ButtonSkeleton, FolderButton } from './FolderButton' import { TypebotButton } from './TypebotButton' import { TypebotCardOverlay } from './TypebotButtonOverlay' +import { isCloudProdInstance } from '@/utils/helpers' type Props = { folder: DashboardFolder | null } @@ -162,6 +163,7 @@ export const FolderContent = ({ folder }: Props) => { {typebots && !isTypebotLoading && user && + isCloudProdInstance && folder === null && env('E2E_TEST') !== 'true' && ( diff --git a/apps/builder/src/utils/helpers.ts b/apps/builder/src/utils/helpers.ts index ea182b8982c..3a81019bfab 100644 --- a/apps/builder/src/utils/helpers.ts +++ b/apps/builder/src/utils/helpers.ts @@ -104,7 +104,7 @@ export const timeSince = (date: string) => { return Math.floor(seconds) + 's' } -export const isCloudProdInstance = () => +export const isCloudProdInstance = typeof window !== 'undefined' && window.location.hostname === 'app.typebot.io' export const numberWithCommas = (x: number) =>