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

View File

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

View File

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

View File

@@ -24,13 +24,4 @@ export const identifyUser = (userId: string) => {
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 }