Skip to content

Commit

Permalink
🛂 (whatsapp) Remove feature flag
Browse files Browse the repository at this point in the history
Closes #401
  • Loading branch information
baptisteArno committed Sep 29, 2023
1 parent 1a4b8bb commit 0e4e10c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 30 deletions.
4 changes: 0 additions & 4 deletions apps/builder/src/features/preview/components/RuntimeMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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}
Expand Down
28 changes: 13 additions & 15 deletions apps/builder/src/features/publish/components/embeds/EmbedButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}>
Expand Down
9 changes: 0 additions & 9 deletions apps/builder/src/features/telemetry/posthog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

2 comments on commit 0e4e10c

@vercel
Copy link

@vercel vercel bot commented on 0e4e10c Sep 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./apps/docs

docs-git-main-typebot-io.vercel.app
docs.typebot.io
docs-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 0e4e10c Sep 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-git-main-typebot-io.vercel.app
builder-v2-typebot-io.vercel.app
app.typebot.io

Please sign in to comment.