diff --git a/apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts b/apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts index f3b5f976741..8a5ba63b44a 100644 --- a/apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts +++ b/apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts @@ -29,9 +29,6 @@ export const accountPlan = { enterprise: "enterprise", } as const; -type AccountStatus = (typeof accountStatus)[keyof typeof accountStatus]; -type AccountPlan = (typeof accountPlan)[keyof typeof accountPlan]; - export type AuthorizedWallet = { id: string; accountId: string; @@ -47,30 +44,17 @@ export type Account = { id: string; isStaff: boolean; creatorWalletAddress: string; - status: AccountStatus; - plan: AccountPlan; name?: string; email?: string; advancedEnabled: boolean; - currentBillingPeriodStartsAt: string; - currentBillingPeriodEndsAt: string; emailConfirmedAt?: string; unconfirmedEmail?: string; - trialPeriodEndedAt?: string; emailConfirmationWalletAddress?: string; - stripePaymentActionUrl?: string; onboardSkipped?: boolean; - paymentAttemptCount?: number; notificationPreferences?: { billing: "email" | "none"; updates: "email" | "none"; }; - recurringPaymentFailures: { - subscriptionId: string; - subscriptionDescription: string; - paymentFailureCode: string; - serviceCutoffDate: string; - }[]; // TODO - add image URL }; @@ -194,33 +178,16 @@ export interface UpdateKeyInput { redirectUrls: string[]; } -interface UsageBundler { - chainId: number; - sumTransactionFee: string; -} - interface UsageStorage { sumFileSizeBytes: number; } -interface UsageEmbeddedWallets { - countWalletAddresses: number; -} - export interface UsageBillableByService { usage: { - bundler: UsageBundler[]; storage: UsageStorage; - embeddedWallets: UsageEmbeddedWallets; - }; - billableUsd: { - bundler: number; - storage: number; - embeddedWallets: number; }; limits: { storage: number; - embeddedWallets: number; }; rateLimits: { storage: number; diff --git a/apps/dashboard/src/app/api/testnet-faucet/claim/route.ts b/apps/dashboard/src/app/api/testnet-faucet/claim/route.ts index 168fc2a20c6..f2d7d0d6e87 100644 --- a/apps/dashboard/src/app/api/testnet-faucet/claim/route.ts +++ b/apps/dashboard/src/app/api/testnet-faucet/claim/route.ts @@ -74,7 +74,7 @@ export const POST = async (req: NextRequest) => { const account: { data: Account } = await accountRes.json(); // Make sure the logged-in account has verified its email - if (account.data.status === "noCustomer") { + if (!account.data.email) { return NextResponse.json( { error: "Account owner hasn't verified email", diff --git a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/create/components/client/create-ecosystem-form.client.tsx b/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/create/components/client/create-ecosystem-form.client.tsx index 65dc1e75a24..26182754aa7 100644 --- a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/create/components/client/create-ecosystem-form.client.tsx +++ b/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/create/components/client/create-ecosystem-form.client.tsx @@ -14,9 +14,7 @@ import { import { ImageUpload } from "@/components/ui/image-upload"; import { Input } from "@/components/ui/input"; import { RadioGroup, RadioGroupItemButton } from "@/components/ui/radio-group"; -import { ToolTipLabel } from "@/components/ui/tooltip"; import { useDashboardRouter } from "@/lib/DashboardRouter"; -import { accountStatus, useAccount } from "@3rdweb-sdk/react/hooks/useApi"; import { zodResolver } from "@hookform/resolvers/zod"; import { Loader2 } from "lucide-react"; import Link from "next/link"; @@ -49,7 +47,6 @@ export function CreateEcosystemForm(props: { const [formDataToBeConfirmed, setFormDataToBeConfirmed] = useState< z.infer | undefined >(); - const { data: billingAccountInfo } = useAccount(); const router = useDashboardRouter(); const form = useForm>({ @@ -164,31 +161,16 @@ export function CreateEcosystemForm(props: { )} /> - {billingAccountInfo?.status !== accountStatus.validPayment ? ( - - {/* Allows the button to be disabled but the tooltip still works */} -
- -
-
- ) : ( - - )} + + = ({ return { total: `${toSize(Math.min(consumedBytes, limitBytes), "MB")} of ${toSize(limitBytes)} included storage used`, progress: percent, - ...(usageData.billableUsd.storage > 0 - ? { - overage: usageData.billableUsd.storage, - } - : {}), totalUsage: `Total Usage: ${toSize(consumedBytes, "MB")}`, }; }, [usageData]); diff --git a/apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/account-abstraction/AccountAbstractionPage.tsx b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/account-abstraction/AccountAbstractionPage.tsx index 8d1c436ec87..3c9571beb30 100644 --- a/apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/account-abstraction/AccountAbstractionPage.tsx +++ b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/account-abstraction/AccountAbstractionPage.tsx @@ -1,12 +1,10 @@ "use client"; - import { Spinner } from "@/components/ui/Spinner/Spinner"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { TrackedLinkTW } from "@/components/ui/tracked-link"; import { type ApiKeyService, accountStatus, - useAccount, } from "@3rdweb-sdk/react/hooks/useApi"; import { useLoggedInUser } from "@3rdweb-sdk/react/hooks/useLoggedInUser"; import { SmartWalletsBillingAlert } from "components/settings/ApiKeys/Alerts"; @@ -26,24 +24,20 @@ export function AccountAbstractionPage(props: { teamSlug: string; projectKey: string; apiKeyServices: ApiKeyService[]; + billingStatus: "validPayment" | (string & {}) | null; tab?: string; }) { const { apiKeyServices } = props; const looggedInUserQuery = useLoggedInUser(); - const accountQuery = useAccount(); const chain = useActiveWalletChain(); const hasSmartWalletsWithoutBilling = useMemo(() => { - if (!accountQuery.data) { - return; - } - return apiKeyServices.find( (s) => - accountQuery.data.status !== accountStatus.validPayment && + props.billingStatus !== accountStatus.validPayment && s.name === "bundler", ); - }, [apiKeyServices, accountQuery.data]); + }, [apiKeyServices, props.billingStatus]); const isOpChain = chain?.id ? isOpChainId(chain.id) : false; diff --git a/apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/account-abstraction/page.tsx b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/account-abstraction/page.tsx index 4f785520351..4b2999a93c3 100644 --- a/apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/account-abstraction/page.tsx +++ b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/account-abstraction/page.tsx @@ -1,7 +1,8 @@ import { getProject } from "@/api/projects"; import { ChakraProviderSetup } from "@/components/ChakraProviderSetup"; import type { Metadata } from "next"; -import { notFound } from "next/navigation"; +import { notFound, redirect } from "next/navigation"; +import { getTeamBySlug } from "../../../../../../@/api/team"; import { getAbsoluteUrl } from "../../../../../../lib/vercel-utils"; import { getAPIKeyForProjectId } from "../../../../../api/lib/getAPIKeys"; import { AccountAbstractionPage } from "./AccountAbstractionPage"; @@ -11,7 +12,15 @@ export default async function Page(props: { searchParams: Promise<{ tab?: string }>; }) { const { team_slug, project_slug } = await props.params; - const project = await getProject(team_slug, project_slug); + + const [team, project] = await Promise.all([ + getTeamBySlug(team_slug), + getProject(team_slug, project_slug), + ]); + + if (!team) { + redirect("/team"); + } if (!project) { notFound(); @@ -28,6 +37,7 @@ export default async function Page(props: { )}