Skip to content

Commit 51a5feb

Browse files
Merge branch 'main' into winston/fix-ecosystem-missing-partner-id
2 parents c438ca4 + e548675 commit 51a5feb

File tree

31 files changed

+576
-1127
lines changed

31 files changed

+576
-1127
lines changed

.changeset/dry-toes-clean.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Switch to v2 bundler for all user operations for better performance

apps/dashboard/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"flat": "^6.0.1",
6464
"framer-motion": "11.9.0",
6565
"fuse.js": "7.0.0",
66+
"input-otp": "^1.2.4",
6667
"ioredis": "^5.4.1",
6768
"ipaddr.js": "^2.2.0",
6869
"lottie-react": "^2.4.0",
@@ -87,7 +88,6 @@
8788
"react-icons": "^5.2.1",
8889
"react-intersection-observer": "^9.10.3",
8990
"react-markdown": "^9.0.1",
90-
"react-otp-input": "^3.1.1",
9191
"react-responsive-carousel": "^3.2.23",
9292
"react-table": "^7.8.0",
9393
"recharts": "^2.12.7",

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import "server-only";
22
import { COOKIE_ACTIVE_ACCOUNT, COOKIE_PREFIX_TOKEN } from "@/constants/cookie";
3+
import { API_SERVER_URL } from "@/constants/env";
34
import { cookies } from "next/headers";
45

5-
const THIRDWEB_API_HOST =
6-
process.env.NEXT_PUBLIC_THIRDWEB_API_HOST || "https://api.thirdweb.com";
7-
86
export type Project = {
97
id: string;
108
name: string;
@@ -34,7 +32,7 @@ export async function getProjects(teamSlug: string) {
3432
}
3533

3634
const teamsRes = await fetch(
37-
`${THIRDWEB_API_HOST}/v1/teams/${teamSlug}/projects`,
35+
`${API_SERVER_URL}/v1/teams/${teamSlug}/projects`,
3836
{
3937
headers: {
4038
Authorization: `Bearer ${token}`,
@@ -59,7 +57,7 @@ export async function getProject(teamSlug: string, projectSlug: string) {
5957
}
6058

6159
const teamsRes = await fetch(
62-
`${THIRDWEB_API_HOST}/v1/teams/${teamSlug}/projects/${projectSlug}`,
60+
`${API_SERVER_URL}/v1/teams/${teamSlug}/projects/${projectSlug}`,
6361
{
6462
headers: {
6563
Authorization: `Bearer ${token}`,

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import "server-only";
22
import { COOKIE_ACTIVE_ACCOUNT, COOKIE_PREFIX_TOKEN } from "@/constants/cookie";
3+
import { API_SERVER_URL } from "@/constants/env";
34
import { cookies } from "next/headers";
45

5-
const THIRDWEB_API_HOST =
6-
process.env.NEXT_PUBLIC_THIRDWEB_API_HOST || "https://api.thirdweb.com";
7-
86
const TeamAccountRole = {
97
OWNER: "OWNER",
108
MEMBER: "MEMBER",
@@ -39,7 +37,7 @@ export async function getMembers(teamSlug: string) {
3937
}
4038

4139
const teamsRes = await fetch(
42-
`${THIRDWEB_API_HOST}/v1/teams/${teamSlug}/members`,
40+
`${API_SERVER_URL}/v1/teams/${teamSlug}/members`,
4341
{
4442
headers: {
4543
Authorization: `Bearer ${token}`,

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import "server-only";
22
import { COOKIE_ACTIVE_ACCOUNT, COOKIE_PREFIX_TOKEN } from "@/constants/cookie";
3+
import { API_SERVER_URL } from "@/constants/env";
34
import { cookies } from "next/headers";
45

5-
const THIRDWEB_API_HOST =
6-
process.env.NEXT_PUBLIC_THIRDWEB_API_HOST || "https://api.thirdweb.com";
7-
86
export type Team = {
97
id: string;
108
name: string;
@@ -35,7 +33,7 @@ export async function getTeamBySlug(slug: string) {
3533
return null;
3634
}
3735

38-
const teamRes = await fetch(`${THIRDWEB_API_HOST}/v1/teams/${slug}`, {
36+
const teamRes = await fetch(`${API_SERVER_URL}/v1/teams/${slug}`, {
3937
headers: {
4038
Authorization: `Bearer ${token}`,
4139
},
@@ -57,7 +55,7 @@ export async function getTeams() {
5755
return [];
5856
}
5957

60-
const teamsRes = await fetch(`${THIRDWEB_API_HOST}/v1/teams`, {
58+
const teamsRes = await fetch(`${API_SERVER_URL}/v1/teams`, {
6159
headers: {
6260
Authorization: `Bearer ${token}`,
6361
},
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
"use client";
2+
3+
import { OTPInput, OTPInputContext } from "input-otp";
4+
import { Dot } from "lucide-react";
5+
import * as React from "react";
6+
7+
import { cn } from "@/lib/utils";
8+
9+
const InputOTP = React.forwardRef<
10+
React.ElementRef<typeof OTPInput>,
11+
React.ComponentPropsWithoutRef<typeof OTPInput>
12+
>(({ className, containerClassName, ...props }, ref) => (
13+
<OTPInput
14+
ref={ref}
15+
containerClassName={cn(
16+
"flex items-center gap-2 has-[:disabled]:opacity-50",
17+
containerClassName,
18+
)}
19+
className={cn("disabled:cursor-not-allowed", className)}
20+
{...props}
21+
/>
22+
));
23+
InputOTP.displayName = "InputOTP";
24+
25+
const InputOTPGroup = React.forwardRef<
26+
React.ElementRef<"div">,
27+
React.ComponentPropsWithoutRef<"div">
28+
>(({ className, ...props }, ref) => (
29+
<div ref={ref} className={cn("flex items-center", className)} {...props} />
30+
));
31+
InputOTPGroup.displayName = "InputOTPGroup";
32+
33+
const InputOTPSlot = React.forwardRef<
34+
React.ElementRef<"div">,
35+
React.ComponentPropsWithoutRef<"div"> & { index: number }
36+
>(({ index, className, ...props }, ref) => {
37+
const inputOTPContext = React.useContext(OTPInputContext);
38+
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];
39+
40+
return (
41+
<div
42+
ref={ref}
43+
className={cn(
44+
"relative flex h-10 w-10 items-center justify-center border-input border-y border-r text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",
45+
isActive && "z-10 ring-2 ring-ring ring-offset-background",
46+
className,
47+
)}
48+
{...props}
49+
>
50+
{char}
51+
{hasFakeCaret && (
52+
<div className="pointer-events-none absolute inset-0 flex items-center justify-center">
53+
<div className="h-4 w-px animate-caret-blink bg-foreground duration-1000" />
54+
</div>
55+
)}
56+
</div>
57+
);
58+
});
59+
InputOTPSlot.displayName = "InputOTPSlot";
60+
61+
const InputOTPSeparator = React.forwardRef<
62+
React.ElementRef<"div">,
63+
React.ComponentPropsWithoutRef<"div">
64+
>(({ ...props }, ref) => (
65+
// biome-ignore lint/a11y/useFocusableInteractive: <explanation>
66+
<div ref={ref} role="separator" {...props}>
67+
<Dot />
68+
</div>
69+
));
70+
InputOTPSeparator.displayName = "InputOTPSeparator";
71+
72+
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };

apps/dashboard/src/@/constants/env.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ export const PROD_OR_DEV_URL = isProd ? "thirdweb.com" : "thirdweb-dev.com";
2020
export const DASHBOARD_STORAGE_URL =
2121
process.env.NEXT_PUBLIC_DASHBOARD_UPLOAD_SERVER ||
2222
"https://storage.thirdweb.com";
23+
24+
export const API_SERVER_URL =
25+
process.env.NEXT_PUBLIC_THIRDWEB_API_HOST || "https://api.thirdweb.com";

apps/dashboard/src/@3rdweb-sdk/react/hooks/useLoggedInUser.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client";
2+
13
import { isLoginRequired } from "@/constants/auth";
24
import { useDashboardRouter } from "@/lib/DashboardRouter";
35
import { useQuery } from "@tanstack/react-query";

apps/dashboard/src/app/(dashboard)/(chain)/utils.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,23 @@ import zytronCTA from "./temp-assets/zytronCTA.jpg";
3737

3838
// END TEMPORARY
3939

40+
import { API_SERVER_URL } from "@/constants/env";
4041
import type { ChainMetadata } from "thirdweb/chains";
4142
import type {
4243
ChainMetadataWithServices,
4344
ChainService,
4445
ChainServices,
4546
} from "./types/chain";
4647

47-
const THIRDWEB_API_HOST =
48-
process.env.NEXT_PUBLIC_THIRDWEB_API_HOST || "https://api.thirdweb.com";
49-
5048
export async function getChains() {
5149
const [chains, chainServices] = await Promise.all([
5250
fetch(
53-
`${THIRDWEB_API_HOST}/v1/chains`,
51+
`${API_SERVER_URL}/v1/chains`,
5452
// revalidate every 60 minutes
5553
{ next: { revalidate: 60 * 60 } },
5654
).then((res) => res.json()) as Promise<{ data: ChainMetadata[] }>,
5755
fetch(
58-
`${THIRDWEB_API_HOST}/v1/chains/services`,
56+
`${API_SERVER_URL}/v1/chains/services`,
5957
// revalidate every 60 minutes
6058
{ next: { revalidate: 60 * 60 } },
6159
).then((res) => res.json()) as Promise<{
@@ -77,12 +75,12 @@ export async function getChain(
7775
): Promise<ChainMetadataWithServices> {
7876
const [chain, chainServices] = await Promise.all([
7977
fetch(
80-
`${THIRDWEB_API_HOST}/v1/chains/${chainIdOrSlug}`,
78+
`${API_SERVER_URL}/v1/chains/${chainIdOrSlug}`,
8179
// revalidate every 15 minutes
8280
{ next: { revalidate: 15 * 60 } },
8381
).then((res) => res.json()) as Promise<{ data: ChainMetadata }>,
8482
fetch(
85-
`${THIRDWEB_API_HOST}/v1/chains/${chainIdOrSlug}/services`,
83+
`${API_SERVER_URL}/v1/chains/${chainIdOrSlug}/services`,
8684
// revalidate every 15 minutes
8785
{ next: { revalidate: 15 * 60 } },
8886
).then((res) => res.json()) as Promise<{ data: ChainServices }>,

apps/dashboard/src/app/(dashboard)/dashboard/connect/ecosystem/utils/fetchEcosystem.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1+
import { API_SERVER_URL } from "@/constants/env";
12
import type { Ecosystem } from "../types";
23

34
export async function fetchEcosystem(slug: string, authToken: string) {
4-
const res = await fetch(
5-
`${process.env.NEXT_PUBLIC_THIRDWEB_API_HOST || "https://api.thirdweb.com"}/v1/ecosystem-wallet/${slug}`,
6-
{
7-
headers: {
8-
Authorization: `Bearer ${authToken}`,
9-
},
5+
const res = await fetch(`${API_SERVER_URL}/v1/ecosystem-wallet/${slug}`, {
6+
headers: {
7+
Authorization: `Bearer ${authToken}`,
108
},
11-
);
9+
});
1210
if (!res.ok) {
1311
const data = await res.json();
1412
console.error(data);

0 commit comments

Comments
 (0)