From fab7e4df185c3a6f0e1a0175db672d9f2385b9f3 Mon Sep 17 00:00:00 2001 From: Bill Date: Fri, 25 Oct 2024 13:36:11 -0700 Subject: [PATCH] feat: add testflag to show deposit toggle (#1223) --- src/lib/testFlags.ts | 4 ++++ src/views/dialogs/DepositDialog.tsx | 5 ++++- src/views/forms/AccountManagementForms/DepositForm.tsx | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/lib/testFlags.ts b/src/lib/testFlags.ts index f6d65c9d5..3205024a9 100644 --- a/src/lib/testFlags.ts +++ b/src/lib/testFlags.ts @@ -69,6 +69,10 @@ class TestFlags { get onboardingRewrite() { return !!this.queryParams.onboarding_rewrite; } + + get showInstantDepositToggle() { + return !!this.queryParams.funkit_toggle; + } } export const testFlags = new TestFlags(); diff --git a/src/views/dialogs/DepositDialog.tsx b/src/views/dialogs/DepositDialog.tsx index c7d1836ef..268fd8192 100644 --- a/src/views/dialogs/DepositDialog.tsx +++ b/src/views/dialogs/DepositDialog.tsx @@ -16,6 +16,8 @@ import { Dialog, DialogPlacement } from '@/components/Dialog'; import { useAppDispatch } from '@/state/appTypes'; import { closeDialog } from '@/state/dialogs'; +import { testFlags } from '@/lib/testFlags'; + import { DepositDialogContent } from './DepositDialog/DepositDialogContent'; enum DepositType { @@ -32,7 +34,8 @@ export const DepositDialog = ({ const startCheckout = useFunkitBuyNobleUsdc(); const dispatch = useAppDispatch(); const ffEnableFunkit = - useStatsigGateValue(StatsigFlags.ffEnableFunkit) && import.meta.env.VITE_FUNKIT_API_KEY; + (useStatsigGateValue(StatsigFlags.ffEnableFunkit) || testFlags.showInstantDepositToggle) && + import.meta.env.VITE_FUNKIT_API_KEY; const { sourceAccount: { walletInfo }, diff --git a/src/views/forms/AccountManagementForms/DepositForm.tsx b/src/views/forms/AccountManagementForms/DepositForm.tsx index 1f5c01be4..68b8cf9ea 100644 --- a/src/views/forms/AccountManagementForms/DepositForm.tsx +++ b/src/views/forms/AccountManagementForms/DepositForm.tsx @@ -82,6 +82,7 @@ import { dd } from '@/lib/analytics/datadog'; import { isNativeDenom, WAGMI_COSMJS_NATIVE_TOKEN_ADDRESS } from '@/lib/assetUtils'; import { MustBigNumber } from '@/lib/numbers'; import { log } from '@/lib/telemetry'; +import { testFlags } from '@/lib/testFlags'; import { sleep } from '@/lib/timeUtils'; import { parseWalletError } from '@/lib/wallet'; @@ -114,7 +115,8 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => { const selectedDydxChainId = useAppSelector(getSelectedDydxChainId); const { hasAcknowledgedTerms } = useAppSelector(getOnboardingGuards); const ffEnableFunkit = - useStatsigGateValue(StatsigFlags.ffEnableFunkit) && import.meta.env.VITE_FUNKIT_API_KEY; + (useStatsigGateValue(StatsigFlags.ffEnableFunkit) || testFlags.showInstantDepositToggle) && + import.meta.env.VITE_FUNKIT_API_KEY; const { dydxAddress,