Skip to content

Commit

Permalink
Add loyalty enabled flag check to onboarding flow
Browse files Browse the repository at this point in the history
  • Loading branch information
vyorkin committed Nov 18, 2024
1 parent bfef47e commit 3d0b554
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions src/ui/features/onboarding/Success/Success.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import starImgSrc from 'src/ui/assets/zer_star.png';
import { useQuery } from '@tanstack/react-query';
import type { ReferrerData } from 'src/modules/zerion-api/requests/check-referral';
import { FEATURE_LOYALTY_FLOW } from 'src/env/config';
import { useRemoteConfigValue } from 'src/modules/remote-config/useRemoteConfigValue';
import { readSavedReferrerData } from '../../referral-program/shared/storage';
import { CongratulationsWidget } from './CongratulationsWidget';
import * as styles from './styles.module.css';
Expand Down Expand Up @@ -100,6 +101,10 @@ export function Success() {
};
}, [fireConfetti]);

const { data: loyaltyEnabled } = useRemoteConfigValue(
'extension_loyalty_enabled'
);

const { data: currentReferrer } = useQuery({
queryKey: ['readSavedReferrerData'],
queryFn: async () => {
Expand Down Expand Up @@ -130,21 +135,22 @@ export function Success() {

const referralCodeWidgetVisible = !referrer;

const loyaltyProgramWidget = FEATURE_LOYALTY_FLOW === 'on' ? (
referralCodeWidgetVisible ? (
<ReferralCodeWidget
onSuccess={(pendingReferrer) => {
setPendingReferrer(pendingReferrer);
fireConfetti();
}}
/>
) : isNarrowView ? null : (
<>
<Spacer height={32} />
<CongratulationsWidget referrer={referrer} />
</>
)
) : null;
const loyaltyProgramWidget =
FEATURE_LOYALTY_FLOW === 'on' && loyaltyEnabled ? (
referralCodeWidgetVisible ? (
<ReferralCodeWidget
onSuccess={(pendingReferrer) => {
setPendingReferrer(pendingReferrer);
fireConfetti();
}}
/>
) : isNarrowView ? null : (
<>
<Spacer height={32} />
<CongratulationsWidget referrer={referrer} />
</>
)
) : null;

return (
<>
Expand Down

0 comments on commit 3d0b554

Please sign in to comment.