2
0

🛂 (whatsapp) Remove feature flag

Closes #401
This commit is contained in:
Baptiste Arnaud
2023-09-29 15:10:39 +02:00
parent 1a4b8bb8fc
commit 0e4e10c77b
4 changed files with 18 additions and 30 deletions

View File

@@ -10,7 +10,6 @@ import {
Text, Text,
} from '@chakra-ui/react' } from '@chakra-ui/react'
import { runtimes } from '../data' import { runtimes } from '../data'
import { isWhatsAppAvailable } from '@/features/telemetry/posthog'
type Runtime = (typeof runtimes)[number] type Runtime = (typeof runtimes)[number]
@@ -37,9 +36,6 @@ export const RuntimeMenu = ({ selectedRuntime, onSelectRuntime }: Props) => {
<MenuList w="100px"> <MenuList w="100px">
{runtimes {runtimes
.filter((runtime) => runtime.name !== selectedRuntime.name) .filter((runtime) => runtime.name !== selectedRuntime.name)
.filter((runtime) =>
runtime.name === 'WhatsApp' ? isWhatsAppAvailable() : true
)
.map((runtime) => ( .map((runtime) => (
<MenuItem <MenuItem
key={runtime.name} key={runtime.name}

View File

@@ -40,7 +40,6 @@ import { NextjsModal } from './modals/Nextjs/NextjsModal'
import { WhatsAppLogo } from '@/components/logos/WhatsAppLogo' import { WhatsAppLogo } from '@/components/logos/WhatsAppLogo'
import { WhatsAppModal } from './modals/WhatsAppModal/WhatsAppModal' import { WhatsAppModal } from './modals/WhatsAppModal/WhatsAppModal'
import { ParentModalProvider } from '@/features/graph/providers/ParentModalProvider' import { ParentModalProvider } from '@/features/graph/providers/ParentModalProvider'
import { isWhatsAppAvailable } from '@/features/telemetry/posthog'
import { useWorkspace } from '@/features/workspace/WorkspaceProvider' import { useWorkspace } from '@/features/workspace/WorkspaceProvider'
import { hasProPerks } from '@/features/billing/helpers/hasProPerks' import { hasProPerks } from '@/features/billing/helpers/hasProPerks'
import { LockTag } from '@/features/billing/components/LockTag' import { LockTag } from '@/features/billing/components/LockTag'
@@ -98,20 +97,19 @@ export const integrationsList = [
(props: Pick<ModalProps, 'publicId' | 'isPublished'>) => { (props: Pick<ModalProps, 'publicId' | 'isPublished'>) => {
const { workspace } = useWorkspace() const { workspace } = useWorkspace()
if (isWhatsAppAvailable()) return (
return ( <ParentModalProvider>
<ParentModalProvider> <EmbedButton
<EmbedButton logo={<WhatsAppLogo height={100} width="70px" />}
logo={<WhatsAppLogo height={100} width="70px" />} label="WhatsApp"
label="WhatsApp" lockTagPlan={hasProPerks(workspace) ? undefined : 'PRO'}
lockTagPlan={hasProPerks(workspace) ? undefined : 'PRO'} modal={({ onClose, isOpen }) => (
modal={({ onClose, isOpen }) => ( <WhatsAppModal isOpen={isOpen} onClose={onClose} {...props} />
<WhatsAppModal isOpen={isOpen} onClose={onClose} {...props} /> )}
)} {...props}
{...props} />
/> </ParentModalProvider>
</ParentModalProvider> )
)
}, },
(props: Pick<ModalProps, 'publicId' | 'isPublished'>) => ( (props: Pick<ModalProps, 'publicId' | 'isPublished'>) => (
<EmbedButton <EmbedButton

View File

@@ -457,12 +457,15 @@ const Webhook = ({
<Stack spacing={6}> <Stack spacing={6}>
<Text> <Text>
In your{' '} In your{' '}
<TextLink <Button
as={Link}
href={`https://developers.facebook.com/apps/${appId}/whatsapp-business/wa-settings`} href={`https://developers.facebook.com/apps/${appId}/whatsapp-business/wa-settings`}
rightIcon={<ExternalLinkIcon />}
isExternal isExternal
size="sm"
> >
WhatsApp Settings page WhatsApp Settings page
</TextLink> </Button>
, click on the Edit button and insert the following values: , click on the Edit button and insert the following values:
</Text> </Text>
<UnorderedList spacing={6}> <UnorderedList spacing={6}>

View File

@@ -24,13 +24,4 @@ export const identifyUser = (userId: string) => {
posthog.identify(userId) posthog.identify(userId)
} }
export const isWhatsAppAvailable = () => {
if (!env.NEXT_PUBLIC_POSTHOG_KEY || !posthog) return true
const isWhatsAppEnabled = posthog.getFeatureFlag('whatsApp', {
send_event: false,
})
if (isWhatsAppEnabled === undefined) return true
return posthog.__loaded && isWhatsAppEnabled
}
export { posthog } export { posthog }