From c0af312e66c3d6e76038b751cb8ad67231709fdf Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Thu, 12 Dec 2024 09:53:49 -0800 Subject: [PATCH 1/2] fix: make it possible to skip the plan gate after Stripe checkout we really don't want to show the plan gate if we just finished Stripe checkout - sometimes Stripe isn't fast enough with the webhook so this will help us provide a UX that makes sense even in this case --- src/components/PlanGate.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/PlanGate.tsx b/src/components/PlanGate.tsx index 1af2b5b..669f38f 100644 --- a/src/components/PlanGate.tsx +++ b/src/components/PlanGate.tsx @@ -7,6 +7,7 @@ import { TopLevelLoader } from './Loader'; import { Logo } from '@/brand'; import { usePlan } from '@/hooks'; import { useRecordRefcode, useReferredBy } from '@/lib/referrals/hooks'; +import { useSearchParams } from 'next/navigation'; export function PlanGate ({ children }: { children: ReactNode }): ReactNode { const [{ accounts }] = useW3() @@ -64,7 +65,8 @@ export function PlanGate ({ children }: { children: ReactNode }): ReactNode { } export function MaybePlanGate ({ children }: { children: ReactNode }): ReactNode { - if (process.env.NEXT_PUBLIC_DISABLE_PLAN_GATE == 'true') { + const params = useSearchParams() + if ((process.env.NEXT_PUBLIC_DISABLE_PLAN_GATE == 'true') || (params.get('checkout') === 'true')) { return children } else { return {children} From 822109b47f9bcacb53a8399b2a27162ec15a14b6 Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Thu, 12 Dec 2024 10:32:41 -0800 Subject: [PATCH 2/2] fix: tweak plan get query param it turns out Stripe already adds the `checkout.session` query param to this URL - this means we don't even need to update Stripe to fix this! --- src/components/PlanGate.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PlanGate.tsx b/src/components/PlanGate.tsx index 669f38f..d365f89 100644 --- a/src/components/PlanGate.tsx +++ b/src/components/PlanGate.tsx @@ -66,7 +66,7 @@ export function PlanGate ({ children }: { children: ReactNode }): ReactNode { export function MaybePlanGate ({ children }: { children: ReactNode }): ReactNode { const params = useSearchParams() - if ((process.env.NEXT_PUBLIC_DISABLE_PLAN_GATE == 'true') || (params.get('checkout') === 'true')) { + if ((process.env.NEXT_PUBLIC_DISABLE_PLAN_GATE == 'true') || params.get('checkout.session')) { return children } else { return {children}