Skip to content

Commit 7c757da

Browse files
committed
Remove unused code from wallet settings components
Deleted unused functions, imports, and types from SMS API and wallet settings components to clean up the codebase. Also changed some exported components to internal where not needed.
1 parent 26980ab commit 7c757da

File tree

4 files changed

+3
-132
lines changed

4 files changed

+3
-132
lines changed

apps/dashboard/src/@/components/blocks/full-width-sidebar-layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
} from "@/components/ui/sidebar";
3131
import { cn } from "@/lib/utils";
3232

33-
export type ShadcnSidebarBaseLink = {
33+
type ShadcnSidebarBaseLink = {
3434
href: string;
3535
label: React.ReactNode;
3636
exactMatch?: boolean;
Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import "server-only";
2-
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
3-
import { API_SERVER_SECRET } from "@/constants/server-envs";
42

53
export type SMSCountryTiers = {
64
tier1: string[];
@@ -10,52 +8,3 @@ export type SMSCountryTiers = {
108
tier5: string[];
119
tier6: string[];
1210
};
13-
14-
export async function getSMSCountryTiers() {
15-
if (!API_SERVER_SECRET) {
16-
throw new Error("API_SERVER_SECRET is not set");
17-
}
18-
const res = await fetch(
19-
`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/sms/list-country-tiers`,
20-
{
21-
headers: {
22-
"Content-Type": "application/json",
23-
"x-service-api-key": API_SERVER_SECRET,
24-
},
25-
next: {
26-
revalidate: 15 * 60, //15 minutes
27-
},
28-
},
29-
);
30-
31-
if (!res.ok) {
32-
console.error(
33-
"Failed to fetch sms country tiers",
34-
res.status,
35-
res.statusText,
36-
);
37-
res.body?.cancel();
38-
return {
39-
tier1: [],
40-
tier2: [],
41-
tier3: [],
42-
tier4: [],
43-
tier5: [],
44-
tier6: [],
45-
};
46-
}
47-
48-
try {
49-
return (await res.json()).data as SMSCountryTiers;
50-
} catch (e) {
51-
console.error("Failed to parse sms country tiers", e);
52-
return {
53-
tier1: [],
54-
tier2: [],
55-
tier3: [],
56-
tier4: [],
57-
tier5: [],
58-
tier6: [],
59-
};
60-
}
61-
}

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/settings/wallets/components/index.tsx

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { zodResolver } from "@hookform/resolvers/zod";
33
import { useMutation } from "@tanstack/react-query";
44
import type { ProjectEmbeddedWalletsService } from "@thirdweb-dev/service-utils";
5-
import { CircleAlertIcon, PlusIcon, Trash2Icon } from "lucide-react";
5+
import { PlusIcon, Trash2Icon } from "lucide-react";
66
import type React from "react";
77
import { useState } from "react";
88
import { type UseFormReturn, useFieldArray, useForm } from "react-hook-form";
@@ -13,7 +13,6 @@ import type { Project } from "@/api/project/projects";
1313
import type { Team } from "@/api/team/get-team";
1414
import { FileInput } from "@/components/blocks/FileInput";
1515
import { GatedSwitch } from "@/components/blocks/GatedSwitch";
16-
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
1716
import { Button } from "@/components/ui/button";
1817
import { DynamicHeight } from "@/components/ui/DynamicHeight";
1918
import {
@@ -31,7 +30,6 @@ import { Spinner } from "@/components/ui/Spinner";
3130
import { Textarea } from "@/components/ui/textarea";
3231
import { UnderlineLink } from "@/components/ui/UnderlineLink";
3332
import { planToTierRecordForGating } from "@/constants/planToTierRecord";
34-
import { updateProjectClient } from "@/hooks/useApi";
3533
import { cn } from "@/lib/utils";
3634
import {
3735
type ApiKeyEmbeddedWalletsValidationSchema,
@@ -57,82 +55,6 @@ type UpdateAPIKeyTrackingData = {
5755
hasCustomAuthEndpoint: boolean;
5856
};
5957

60-
export function InAppWalletSettingsPage(props: InAppWalletSettingsPageProps) {
61-
const updateProject = useMutation({
62-
mutationFn: async (projectValues: Partial<Project>) => {
63-
await updateProjectClient(
64-
{
65-
projectId: props.project.id,
66-
teamId: props.teamId,
67-
},
68-
projectValues,
69-
);
70-
},
71-
});
72-
73-
function handleUpdateProject(projectValues: Partial<Project>) {
74-
updateProject.mutate(projectValues, {
75-
onError: (err) => {
76-
toast.error("Failed to update an API Key");
77-
console.error(err);
78-
},
79-
onSuccess: () => {
80-
toast.success("In-App Wallet API Key configuration updated");
81-
},
82-
});
83-
}
84-
85-
return (
86-
<InAppWalletSettingsPageUI
87-
{...props}
88-
isUpdating={updateProject.isPending}
89-
smsCountryTiers={props.smsCountryTiers}
90-
updateApiKey={handleUpdateProject}
91-
/>
92-
);
93-
}
94-
95-
const InAppWalletSettingsPageUI: React.FC<
96-
InAppWalletSettingsPageProps & {
97-
updateApiKey: (
98-
projectValues: Partial<Project>,
99-
trackingData: UpdateAPIKeyTrackingData,
100-
) => void;
101-
isUpdating: boolean;
102-
smsCountryTiers: SMSCountryTiers;
103-
}
104-
> = (props) => {
105-
const embeddedWalletService = props.project.services.find(
106-
(service) => service.name === "embeddedWallets",
107-
);
108-
109-
if (!embeddedWalletService) {
110-
return (
111-
<Alert variant="warning">
112-
<CircleAlertIcon className="size-5" />
113-
<AlertTitle>In-App wallets service is disabled</AlertTitle>
114-
<AlertDescription>
115-
Enable In-App wallets service in the{" "}
116-
<UnderlineLink
117-
href={`/team/${props.teamSlug}/${props.project.slug}/settings`}
118-
>
119-
project settings
120-
</UnderlineLink>{" "}
121-
to configure settings
122-
</AlertDescription>
123-
</Alert>
124-
);
125-
}
126-
127-
return (
128-
<InAppWalletSettingsUI
129-
{...props}
130-
client={props.client}
131-
embeddedWalletService={embeddedWalletService}
132-
/>
133-
);
134-
};
135-
13658
export const InAppWalletSettingsUI: React.FC<
13759
InAppWalletSettingsPageProps & {
13860
updateApiKey: (

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/wallets/user-wallets/configuration/components/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const InAppWalletSettingsPageUI: React.FC<
133133
);
134134
};
135135

136-
export const InAppWalletSettingsUI: React.FC<
136+
const InAppWalletSettingsUI: React.FC<
137137
InAppWalletSettingsPageProps & {
138138
updateApiKey: (
139139
projectValues: Partial<Project>,

0 commit comments

Comments
 (0)