Skip to content

Commit 8610b46

Browse files
committed
[TOOL-3447] Dashboard: Remove /v1/keys usage (#6293)
<!-- start pr-codex --> ## PR-Codex overview This PR focuses on refactoring the project and team management functionalities in the application, specifically updating the handling of API keys, project settings, and team responses, alongside improving redirection logic and type definitions. ### Detailed summary - Removed `getAPIKeys.ts`. - Updated types for `TeamResponse` and `ProjectResponse`. - Changed redirection logic in various components to use the correct team/project slugs. - Updated `ProjectGeneralSettingsPage` to use the new project structure. - Refactored API key handling to support new project structure. - Replaced instances of `LazyCreateAPIKeyDialog` with `LazyCreateProjectDialog`. - Updated service utilities to include new project-related types. - Improved error handling and user feedback in settings pages. > The following files were skipped due to too many changes: `apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts`, `apps/dashboard/src/components/settings/ApiKeys/Create/index.tsx`, `apps/dashboard/src/app/team/[team_slug]/[project_slug]/settings/ProjectGeneralSettingsPage.tsx` > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent d4a49b2 commit 8610b46

File tree

41 files changed

+1057
-1402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1057
-1402
lines changed

.changeset/funny-dragons-thank.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@thirdweb-dev/service-utils": patch
3+
---
4+
5+
Update TeamResponse and ProjectResponse types

apps/dashboard/src/@/api/projects.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,9 @@
11
import "server-only";
22
import { API_SERVER_URL } from "@/constants/env";
3+
import type { ProjectResponse } from "@thirdweb-dev/service-utils";
34
import { getAuthToken } from "../../app/api/lib/getAuthToken";
45

5-
export type Project = {
6-
id: string;
7-
name: string;
8-
createdAt: Date;
9-
updatedAt: Date;
10-
deletedAt: Date | null;
11-
bannedAt: Date | null;
12-
domains: string[];
13-
bundleIds: string[];
14-
redirectUrls: string[];
15-
lastAccessedAt: Date | null;
16-
slug: string;
17-
teamId: string;
18-
publishableKey: string;
19-
// image: string; // TODO
20-
};
6+
export type Project = ProjectResponse;
217

228
export async function getProjects(teamSlug: string) {
239
const token = await getAuthToken();

apps/dashboard/src/@/api/team.ts

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,9 @@
11
import "server-only";
22
import { API_SERVER_URL } from "@/constants/env";
3+
import type { TeamResponse } from "@thirdweb-dev/service-utils";
34
import { getAuthToken } from "../../app/api/lib/getAuthToken";
45

5-
type EnabledTeamScope =
6-
| "pay"
7-
| "storage"
8-
| "rpc"
9-
| "bundler"
10-
| "insight"
11-
| "embeddedWallets"
12-
| "relayer"
13-
| "chainsaw"
14-
| "nebula";
15-
16-
export type Team = {
17-
id: string;
18-
name: string;
19-
slug: string;
20-
createdAt: string;
21-
updatedAt: string;
22-
deletedAt?: string;
23-
bannedAt?: string;
24-
image?: string;
25-
billingPlan: "pro" | "growth" | "free" | "starter";
26-
billingStatus: "validPayment" | (string & {}) | null;
27-
supportPlan: "pro" | "growth" | "free" | "starter";
28-
billingEmail: string | null;
29-
growthTrialEligible: false;
30-
enabledScopes: EnabledTeamScope[];
31-
};
32-
6+
export type Team = TeamResponse;
337
export async function getTeamBySlug(slug: string) {
348
const token = await getAuthToken();
359

apps/dashboard/src/@3rdweb-sdk/react/cache-keys.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,6 @@ export const accountKeys = {
4242
[...accountKeys.wallet(walletAddress), "billing-session"] as const,
4343
};
4444

45-
export const apiKeys = {
46-
all: ["api"] as const,
47-
wallet: (walletAddress: string) => [...apiKeys.all, walletAddress] as const,
48-
keys: (walletAddress: string) =>
49-
[...apiKeys.wallet(walletAddress), "keys"] as const,
50-
key: (id: string, walletAddress: string) =>
51-
[...apiKeys.keys(walletAddress), id] as const,
52-
};
53-
5445
export const authorizedWallets = {
5546
all: ["authorizedWallets"] as const,
5647
wallet: (walletAddress: string) =>

0 commit comments

Comments
 (0)