2
0

🛂 Disable direct support for Free users

Closes #1318
This commit is contained in:
Baptiste Arnaud
2024-03-04 17:57:32 +01:00
parent daaca9f817
commit 6d8a007f09
11 changed files with 98 additions and 5 deletions

View File

@ -16,6 +16,7 @@ import { GraphDndProvider } from '@/features/graph/providers/GraphDndProvider'
import { GraphProvider } from '@/features/graph/providers/GraphProvider'
import { EventsCoordinatesProvider } from '@/features/graph/providers/EventsCoordinateProvider'
import { TypebotNotFoundPage } from './TypebotNotFoundPage'
import { SuspectedTypebotBanner } from './SuspectedTypebotBanner'
export const EditorPage = () => {
const { typebot, currentUserMode, is404 } = useTypebot()
@ -31,6 +32,9 @@ export const EditorPage = () => {
<Seo title={typebot?.name ? `${typebot.name} | Editor` : 'Editor'} />
<Flex overflow="clip" h="100vh" flexDir="column" id="editor-container">
<GettingStartedModal />
{typebot?.riskLevel === 100 && (
<SuspectedTypebotBanner typebotId={typebot.id} />
)}
<TypebotHeader />
<Flex
flex="1"

View File

@ -0,0 +1,40 @@
import { TextLink } from '@/components/TextLink'
import { useUser } from '@/features/account/hooks/useUser'
import { HStack, Text } from '@chakra-ui/react'
type Props = {
typebotId: string
}
export const SuspectedTypebotBanner = ({ typebotId }: Props) => {
const { user } = useUser()
if (!user?.email) return null
return (
<HStack
bgColor="red.500"
w="full"
zIndex={1000}
color="white"
justifyContent="center"
fontSize="sm"
textAlign="center"
py="2"
>
<Text fontWeight="bold">
Our anti-scam system flagged your typebot. It is currently being
reviewed manually.
<br />
If you think that&apos;s a mistake,{' '}
<TextLink
href={`https://typebot.co/claim-non-scam?Email=${encodeURIComponent(
user.email
)}&typebotId=${typebotId}`}
>
contact us
</TextLink>
.
</Text>
</HStack>
)
}

View File

@ -33,6 +33,8 @@ import { isCloudProdInstance } from '@/helpers/isCloudProdInstance'
import { useTranslate } from '@tolgee/react'
import { GuestTypebotHeader } from './UnauthenticatedTypebotHeader'
import { useKeyboardShortcuts } from '@/hooks/useKeyboardShortcuts'
import { useWorkspace } from '@/features/workspace/WorkspaceProvider'
import { Plan } from '@typebot.io/prisma'
export const TypebotHeader = () => {
const { t } = useTranslate()
@ -49,6 +51,7 @@ export const TypebotHeader = () => {
isSavingLoading,
currentUserMode,
} = useTypebot()
const { workspace } = useWorkspace()
const {
setRightPanel,
rightPanel,
@ -99,9 +102,9 @@ export const TypebotHeader = () => {
})
const handleHelpClick = () => {
isCloudProdInstance()
isCloudProdInstance() && workspace?.plan && workspace.plan !== Plan.FREE
? onOpen()
: window.open('https://docs.typebot.io', '_blank')
: window.open('https://docs.typebot.io/guides/how-to-get-help', '_blank')
}
if (currentUserMode === 'guest') return <GuestTypebotHeader />