From f7f74d9e83d0d28227ac70650f0e91ea8dc8ddf9 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Mon, 21 Apr 2025 15:01:17 -0600 Subject: [PATCH] 402 redirect page --- .../api/buster_rest/users/queryRequests.ts | 2 +- web/src/app/app/layout.tsx | 12 ++++- web/src/app/info/getting-started/page.tsx | 50 +++++++++++++++++++ .../routes/busterRoutes/busterInfoRoutes.ts | 7 +++ web/src/routes/busterRoutes/busterRoutes.ts | 6 ++- web/src/routes/externalRoutes.ts | 1 + 6 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 web/src/app/info/getting-started/page.tsx create mode 100644 web/src/routes/busterRoutes/busterInfoRoutes.ts diff --git a/web/src/api/buster_rest/users/queryRequests.ts b/web/src/api/buster_rest/users/queryRequests.ts index 623e5694b..f218286b6 100644 --- a/web/src/api/buster_rest/users/queryRequests.ts +++ b/web/src/api/buster_rest/users/queryRequests.ts @@ -39,7 +39,7 @@ export const prefetchGetMyUserInfo = async ( queryFn: () => initialData!, initialData }); - return { queryClient, initialData }; + return queryClient; }; export const useGetUser = (params: Parameters[0]) => { diff --git a/web/src/app/app/layout.tsx b/web/src/app/app/layout.tsx index 322259af0..9e7ce7b94 100644 --- a/web/src/app/app/layout.tsx +++ b/web/src/app/app/layout.tsx @@ -8,6 +8,7 @@ import { prefetchGetMyUserInfo } from '@/api/buster_rest'; import { getSupabaseUserContext } from '@/lib/supabase'; import { AppProviders } from '@/context/AppProviders'; import { headers } from 'next/headers'; +import { queryKeys } from '@/api/query_keys'; export default async function Layout({ children @@ -18,10 +19,19 @@ export default async function Layout({ const pathname = headersList.get('x-pathname'); const supabaseContext = await getSupabaseUserContext(); const { accessToken } = supabaseContext; - const { initialData: userInfo, queryClient } = await prefetchGetMyUserInfo({ + const queryClient = await prefetchGetMyUserInfo({ jwtToken: accessToken }); + const userInfoState = queryClient.getQueryState(queryKeys.userGetUserMyself.queryKey); + + const is402Error = userInfoState?.status === 'error' && userInfoState?.error?.status === 402; + + if (is402Error) { + return ; + } + + const userInfo = queryClient.getQueryData(queryKeys.userGetUserMyself.queryKey); const newUserRoute = createBusterRoute({ route: BusterRoutes.NEW_USER }); if ( diff --git a/web/src/app/info/getting-started/page.tsx b/web/src/app/info/getting-started/page.tsx new file mode 100644 index 000000000..2029782ad --- /dev/null +++ b/web/src/app/info/getting-started/page.tsx @@ -0,0 +1,50 @@ +import { Paragraph, Text, Title } from '@/components/ui/typography'; +import { Button } from '@/components/ui/buttons'; +import { Card, CardContent, CardFooter } from '@/components/ui/card/CardBase'; +import { BUSTER_GETTING_STARTED_URL } from '@/routes/externalRoutes'; +import { BusterLogo } from '@/assets/svg/BusterLogo'; +import { ArrowUpRight } from '@/components/ui/icons'; + +export default function GettingStartedPage() { + return ( +
+ + + <> +
+ +
+ + + Welcome to Buster! + + + It looks like your organization hasn't been fully set up yet. To get started with + Buster, you'll need to complete the organization setup process or verify your + payment information. + + +
+ + + + + +
+
+ ); +} diff --git a/web/src/routes/busterRoutes/busterInfoRoutes.ts b/web/src/routes/busterRoutes/busterInfoRoutes.ts new file mode 100644 index 000000000..3509aaa56 --- /dev/null +++ b/web/src/routes/busterRoutes/busterInfoRoutes.ts @@ -0,0 +1,7 @@ +export enum BusterInfoRoutes { + INFO_GETTING_STARTED = '/info/getting-started' +} + +export type BusterInfoRoutesWithArgs = { + [BusterInfoRoutes.INFO_GETTING_STARTED]: { route: BusterInfoRoutes.INFO_GETTING_STARTED }; +}; diff --git a/web/src/routes/busterRoutes/busterRoutes.ts b/web/src/routes/busterRoutes/busterRoutes.ts index 1ccb050a9..872efbd4d 100644 --- a/web/src/routes/busterRoutes/busterRoutes.ts +++ b/web/src/routes/busterRoutes/busterRoutes.ts @@ -1,6 +1,7 @@ import { BusterAppRoutes, BusterAppRoutesWithArgs } from './busterAppRoutes'; import { BusterAuthRoutes, BusterAuthRoutesWithArgs } from './busterAuthRoutes'; import { BusterEmbedRoutes, BusterEmbedRoutesWithArgs } from './busterEmbedRoutes'; +import { BusterInfoRoutes, BusterInfoRoutesWithArgs } from './busterInfoRoutes'; import { BusterSettingsRoutes, BusterSettingsRoutesWithArgs } from './busterSettingsRoutes'; export enum BusterRootRoutes { @@ -16,6 +17,7 @@ export const BusterRoutes = { ...BusterAuthRoutes, ...BusterSettingsRoutes, ...BusterEmbedRoutes, + ...BusterInfoRoutes, ...BusterRootRoutes }; @@ -24,12 +26,14 @@ export type BusterRoutes = | BusterAuthRoutes | BusterSettingsRoutes | BusterEmbedRoutes + | BusterInfoRoutes | BusterRootRoutes; export type BusterRoutesWithArgs = BusterRootRoutesWithArgs & BusterAuthRoutesWithArgs & BusterAppRoutesWithArgs & BusterEmbedRoutesWithArgs & - BusterSettingsRoutesWithArgs; + BusterSettingsRoutesWithArgs & + BusterInfoRoutesWithArgs; export type BusterRoutesWithArgsRoute = BusterRoutesWithArgs[BusterRoutes]; diff --git a/web/src/routes/externalRoutes.ts b/web/src/routes/externalRoutes.ts index 2514f5cbc..ccd743274 100644 --- a/web/src/routes/externalRoutes.ts +++ b/web/src/routes/externalRoutes.ts @@ -1,2 +1,3 @@ export const BUSTER_HOME_PAGE = 'https://buster.so'; export const BUSTER_DOCS_URL = 'https://docs.buster.so'; +export const BUSTER_GETTING_STARTED_URL = 'https://www.buster.so/get-started';