Skip to content

Commit

Permalink
chore(web): Add feature flag for Hubspot onboarding flow (#5386)
Browse files Browse the repository at this point in the history
* chore: Add feature flag for Hubspot onboarding flow

* fix: Add missing condition
  • Loading branch information
rifont authored Apr 9, 2024
1 parent 4a22dcf commit 6a68f5d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
16 changes: 13 additions & 3 deletions apps/web/src/pages/auth/QuestionnairePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,33 @@ import AuthContainer from '../../components/layout/components/AuthContainer';
import { QuestionnaireForm } from './components/QuestionnaireForm';
import { useVercelIntegration } from '../../hooks';
import SetupLoader from './components/SetupLoader';
import { ENV, IS_DOCKER_HOSTED } from '@novu/shared-web';
import { ENV, IS_DOCKER_HOSTED, useFeatureFlag } from '@novu/shared-web';
import { HubspotSignupForm } from './components/HubspotSignupForm';
import { FeatureFlagsKeysEnum } from '@novu/shared';
import { When } from '@novu/design-system';

export default function QuestionnairePage() {
const { isLoading } = useVercelIntegration();
const isHubspotFormEnabled = useFeatureFlag(FeatureFlagsKeysEnum.IS_HUBSPOT_ONBOARDING_ENABLED);
const isNovuProd = !IS_DOCKER_HOSTED && ENV === 'production';

const shouldUseHubspotForm = isHubspotFormEnabled && isNovuProd;

return (
<AuthLayout>
{isLoading ? (
<SetupLoader title="Loading..." />
) : (
<AuthContainer
title="Customize your experience"
description={!isNovuProd ? 'Your answers can decrease the time to get started' : ''}
description={!shouldUseHubspotForm ? 'Your answers can decrease the time to get started' : ''}
>
{!isNovuProd ? <QuestionnaireForm /> : <HubspotSignupForm />}
<When truthy={shouldUseHubspotForm}>
<HubspotSignupForm />
</When>
<When truthy={!shouldUseHubspotForm}>
<QuestionnaireForm />
</When>
</AuthContainer>
)}
</AuthLayout>
Expand Down
1 change: 1 addition & 0 deletions libs/shared/src/types/feature-flags/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export enum FeatureFlagsKeysEnum {
IS_IMPROVED_ONBOARDING_ENABLED = 'IS_IMPROVED_ONBOARDING_ENABLED',
IS_NEW_MESSAGES_API_RESPONSE_ENABLED = 'IS_NEW_MESSAGES_API_RESPONSE_ENABLED',
IS_BILLING_REVERSE_TRIAL_ENABLED = 'IS_BILLING_REVERSE_TRIAL_ENABLED',
IS_HUBSPOT_ONBOARDING_ENABLED = 'IS_HUBSPOT_ONBOARDING_ENABLED',
}

0 comments on commit 6a68f5d

Please sign in to comment.