Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/dashboard/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
51 changes: 51 additions & 0 deletions apps/dashboard/src/@/actions/acceptInvite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
"use server";
import "server-only";
import { redirect } from "next/navigation";
import { getAuthToken } from "../../app/api/lib/getAuthToken";
import type { Team } from "../api/team";
import { API_SERVER_URL } from "../constants/env";

export async function acceptInvite(options: {
teamId: string;
inviteId: string;
}) {
const token = await getAuthToken();

if (!token) {
return {
errorMessage: "You are not authorized to perform this action",
};
}

const res = await fetch(
`${API_SERVER_URL}/v1/teams/${options.teamId}/invites/${options.inviteId}/accept`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({}),
},
);

if (!res.ok) {
let errorMessage = "Failed to accept invite";
try {
const result = (await res.json()) as {
error: {
code: string;
message: string;
statusCode: number;
};
};
errorMessage = result.error.message;
} catch {}
throw new Error(errorMessage);
}

const { team } = (await res.json()).result as { team: Team };

// redirect to the team page
redirect(`/team/${team.slug}`);
}
37 changes: 37 additions & 0 deletions apps/dashboard/src/@/actions/sendTeamInvite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"use server";
import "server-only";
import { getAuthToken } from "../../app/api/lib/getAuthToken";
import { API_SERVER_URL } from "../constants/env";

export async function sendTeamInvite(options: {
teamId: string;
email: string;
role: "OWNER" | "MEMBER";
}) {
const token = await getAuthToken();

if (!token) {
throw new Error("You are not authorized to perform this action");
}

const res = await fetch(
`${API_SERVER_URL}/v1/teams/${options.teamId}/invites`,
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
inviteEmail: options.email,
inviteRole: options.role,
}),
},
);

if (!res.ok) {
throw new Error("Failed to send invite");
}

return true;
}
19 changes: 18 additions & 1 deletion apps/dashboard/src/@/api/team.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "server-only";
import { API_SERVER_URL } from "@/constants/env";
import { API_SERVER_URL, THIRDWEB_API_SECRET } from "@/constants/env";
import { getAuthToken } from "../../app/api/lib/getAuthToken";

type EnabledTeamScope =
Expand Down Expand Up @@ -30,6 +30,23 @@ export type Team = {
enabledScopes: EnabledTeamScope[];
};

export async function service_getTeamBySlug(slug: string) {
if (!THIRDWEB_API_SECRET) {
throw new Error("API_SERVER_SECRET is not set");
}

const teamRes = await fetch(`${API_SERVER_URL}/v1/teams/${slug}`, {
headers: {
"x-service-api-key": THIRDWEB_API_SECRET,
},
});

if (teamRes.ok) {
return (await teamRes.json())?.result as Team;
}
return null;
}

export async function getTeamBySlug(slug: string) {
const token = await getAuthToken();

Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@3rdweb-sdk/react/hooks/useEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import {
useQuery,
useQueryClient,
} from "@tanstack/react-query";
import type { ResultItem } from "app/team/[team_slug]/(team)/~/engine/(instance)/[engineId]/metrics/components/StatusCodes";
import type { ResultItem } from "app/team/[team_slug]/(internal)/(team)/~/engine/(instance)/[engineId]/metrics/components/StatusCodes";
import type { EngineStatus } from "app/team/[team_slug]/(internal)/(team)/~/engine/(instance)/[engineId]/overview/components/transactions-table";
import type { EngineBackendWalletType } from "lib/engine";
import { useState } from "react";
import { useActiveAccount } from "thirdweb/react";
import invariant from "tiny-invariant";
import type { EngineStatus } from "../../../app/team/[team_slug]/(team)/~/engine/(instance)/[engineId]/overview/components/transactions-table";
import { engineKeys } from "../cache-keys";

export type EngineTier = "STARTER" | "PREMIUM" | "ENTERPRISE";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
AddToProjectSelector,
type MinimalTeamsAndProjects,
} from "../../../../../../components/contract-components/contract-deploy-form/add-to-project-card";
import { useAddContractToProject } from "../../../../../team/[team_slug]/[project_slug]/hooks/project-contracts";
import { useAddContractToProject } from "../../../../../team/[team_slug]/(internal)/[project_slug]/hooks/project-contracts";

const TRACKING_CATEGORY = "add_to_dashboard_upsell";

Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/app/nebula-app/(app)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
getAuthTokenWalletAddress,
} from "../../api/lib/getAuthToken";
import { loginRedirect } from "../../login/loginRedirect";
import { NebulaWaitListPage } from "../../team/[team_slug]/[project_slug]/nebula/components/nebula-waitlist-page";
import { NebulaWaitListPage } from "../../team/[team_slug]/(internal)/[project_slug]/nebula/components/nebula-waitlist-page";
import { getSessions } from "./api/session";
import { ChatPageLayout } from "./components/ChatPageLayout";
import { NebulaAccountButton } from "./components/NebulaAccountButton";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { cn } from "@/lib/utils";
import { EmptyAccountAbstractionChartContent } from "components/smart-wallets/AccountAbstractionAnalytics/SponsoredTransactionsChartCard";
import { defineChain } from "thirdweb";
import { type ChainMetadata, getChainMetadata } from "thirdweb/chains";
import type { UserOpStats } from "types/analytics";
import { EmptyAccountAbstractionChartContent } from "../../../../../components/smart-wallets/AccountAbstractionAnalytics/SponsoredTransactionsChartCard";
import { BarChart } from "../../../components/Analytics/BarChart";
import { CombinedBarChartCard } from "../../../components/Analytics/CombinedBarChartCard";
import { BarChart } from "../../../../components/Analytics/BarChart";
import { CombinedBarChartCard } from "../../../../components/Analytics/CombinedBarChartCard";

export async function TotalSponsoredChartCardUI({
data,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { cn } from "@/lib/utils";
import { EmptyAccountAbstractionChartContent } from "components/smart-wallets/AccountAbstractionAnalytics/SponsoredTransactionsChartCard";
import { defineChain } from "thirdweb";
import { type ChainMetadata, getChainMetadata } from "thirdweb/chains";
import type { TransactionStats } from "types/analytics";
import { EmptyAccountAbstractionChartContent } from "../../../../../components/smart-wallets/AccountAbstractionAnalytics/SponsoredTransactionsChartCard";
import { BarChart } from "../../../components/Analytics/BarChart";
import { CombinedBarChartCard } from "../../../components/Analytics/CombinedBarChartCard";
import { BarChart } from "../../../../components/Analytics/BarChart";
import { CombinedBarChartCard } from "../../../../components/Analytics/CombinedBarChartCard";

export async function TransactionsChartCardUI({
data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { getProjects } from "@/api/projects";
import { getTeamNebulaWaitList, getTeams } from "@/api/team";
import { TabPathLinks } from "@/components/ui/tabs";
import { redirect } from "next/navigation";
import { getValidAccount } from "../../../account/settings/getAccount";
import { getAuthTokenWalletAddress } from "../../../api/lib/getAuthToken";
import { TeamHeaderLoggedIn } from "../../components/TeamHeader/team-header-logged-in.client";
import { getValidAccount } from "../../../../account/settings/getAccount";
import { getAuthTokenWalletAddress } from "../../../../api/lib/getAuthToken";
import { TeamHeaderLoggedIn } from "../../../components/TeamHeader/team-header-logged-in.client";

export default async function TeamLayout(props: {
children: React.ReactNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import {
} from "components/analytics/date-range-selector";

import { type WalletId, getWalletInfo } from "thirdweb/wallets";
import { AnalyticsHeader } from "../../../../components/Analytics/AnalyticsHeader";
import { CombinedBarChartCard } from "../../../../components/Analytics/CombinedBarChartCard";
import { EmptyState } from "../../../../components/Analytics/EmptyState";
import { PieChartCard } from "../../../../components/Analytics/PieChartCard";
import { AnalyticsHeader } from "../../../../../components/Analytics/AnalyticsHeader";
import { CombinedBarChartCard } from "../../../../../components/Analytics/CombinedBarChartCard";
import { EmptyState } from "../../../../../components/Analytics/EmptyState";
import { PieChartCard } from "../../../../../components/Analytics/PieChartCard";

import { getTeamBySlug } from "@/api/team";
import { GenericLoadingPage } from "@/components/blocks/skeletons/GenericLoadingPage";
Expand All @@ -35,7 +35,7 @@ import { TotalSponsoredChartCardUI } from "../../_components/TotalSponsoredCard"
import { TransactionsChartCardUI } from "../../_components/TransactionsCard";

// revalidate every 5 minutes
export const maxDuration = 300;
// export const maxDuration = 300;

type SearchParams = {
usersChart?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getAuthToken } from "../../../../../../../../api/lib/getAuthToken";
import { loginRedirect } from "../../../../../../../../login/loginRedirect";
import { getAuthToken } from "../../../../../../../../../api/lib/getAuthToken";
import { loginRedirect } from "../../../../../../../../../login/loginRedirect";
import { EcosystemPermissionsPage } from "./components/client/EcosystemPermissionsPage";

export default async function Page(props: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getAuthToken } from "../../../../../../../api/lib/getAuthToken";
import { loginRedirect } from "../../../../../../../login/loginRedirect";
import { getAuthToken } from "../../../../../../../../api/lib/getAuthToken";
import { loginRedirect } from "../../../../../../../../login/loginRedirect";
import { EcosystemPermissionsPage } from "./configuration/components/client/EcosystemPermissionsPage";

export default async function Page(props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { API_SERVER_URL, BASE_URL } from "@/constants/env";
import { getThirdwebClient } from "@/constants/thirdweb.server";
import { redirect } from "next/navigation";
import { upload } from "thirdweb/storage";
import { getAuthToken } from "../../../../../../../api/lib/getAuthToken";
import { getAuthToken } from "../../../../../../../../api/lib/getAuthToken";

export async function createEcosystem(options: {
teamSlug: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import emptyStateHeaderImage from "../../../../../../../../../public/assets/engine/empty-state-header.png";
import emptyStateHeaderImage from "../../../../../../../../../../public/assets/engine/empty-state-header.png";
import { EngineInstancesTable } from "./engine-instances-table";

export const EngineInstancesList = (props: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { redirect } from "next/navigation";
import { getAuthToken } from "../../../../../../api/lib/getAuthToken";
import { loginRedirect } from "../../../../../../login/loginRedirect";
import { getAuthToken } from "../../../../../../../api/lib/getAuthToken";
import { loginRedirect } from "../../../../../../../login/loginRedirect";
import { getEngineInstances } from "../_utils/getEngineInstances";
import {
EngineInstancesList,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { Separator } from "@/components/ui/separator";
import type { EngineInstance } from "@3rdweb-sdk/react/hooks/useEngine";
import { ArrowLeftIcon } from "lucide-react";
import Link from "next/link";
import { getValidAccount } from "../../../../../../../account/settings/getAccount";
import { getAuthToken } from "../../../../../../../api/lib/getAuthToken";
import { loginRedirect } from "../../../../../../../login/loginRedirect";
import { getValidAccount } from "../../../../../../../../account/settings/getAccount";
import { getAuthToken } from "../../../../../../../../api/lib/getAuthToken";
import { loginRedirect } from "../../../../../../../../login/loginRedirect";
import { getEngineInstance } from "../../_utils/getEngineInstance";
import { EngineErrorPage } from "./_components/EngineErrorPage";
import { EngineSidebarLayout } from "./_components/EnginePageLayout";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import Link from "next/link";
import { type Dispatch, type SetStateAction, useMemo, useState } from "react";
import { toTokens } from "thirdweb";
import { FormLabel, LinkButton, Text } from "tw-components";
import { normalizeTime } from "../../../../../../../../../../lib/time";
import { normalizeTime } from "../../../../../../../../../../../lib/time";
import { TransactionTimeline } from "./transaction-timeline";

export type EngineStatus =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { notFound } from "next/navigation";
import { getValidAccount } from "../../../../../../account/settings/getAccount";
import { getAuthToken } from "../../../../../../api/lib/getAuthToken";
import { loginRedirect } from "../../../../../../login/loginRedirect";
import { getValidAccount } from "../../../../../../../account/settings/getAccount";
import { getAuthToken } from "../../../../../../../api/lib/getAuthToken";
import { loginRedirect } from "../../../../../../../login/loginRedirect";
import { getEngineInstance } from "./getEngineInstance";

export async function engineInstancePageHandler(params: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getTeamBySlug } from "@/api/team";
import { getValidAccount } from "../../../../../account/settings/getAccount";
import { getAuthToken } from "../../../../../api/lib/getAuthToken";
import { loginRedirect } from "../../../../../login/loginRedirect";
import { getValidAccount } from "../../../../../../account/settings/getAccount";
import { getAuthToken } from "../../../../../../api/lib/getAuthToken";
import { loginRedirect } from "../../../../../../login/loginRedirect";
import { NebulaAnalyticsPage } from "../../../[project_slug]/nebula/components/analytics/nebula-analytics-page";
import { NebulaWaitListPage } from "../../../[project_slug]/nebula/components/nebula-waitlist-page";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { teamStub, teamSubscriptionsStub } from "stories/stubs";
import {
BadgeContainer,
mobileViewport,
} from "../../../../../../../../stories/utils";
} from "../../../../../../../../../stories/utils";
import { PlanInfoCard } from "./PlanInfoCard";

const meta = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { TrackedLinkTW } from "@/components/ui/tracked-link";
import { differenceInDays, isAfter } from "date-fns";
import { format } from "date-fns/format";
import { CircleAlertIcon } from "lucide-react";
import { getValidTeamPlan } from "../../../../../../components/TeamHeader/getValidTeamPlan";
import { getValidTeamPlan } from "../../../../../../../components/TeamHeader/getValidTeamPlan";

export function PlanInfoCard(props: {
subscriptions: TeamSubscription[];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getTeamBySlug } from "@/api/team";
import { getTeamSubscriptions } from "@/api/team-subscription";
import { redirect } from "next/navigation";
import { Billing } from "../../../../../../../components/settings/Account/Billing";
import { getValidAccount } from "../../../../../../account/settings/getAccount";
import { Billing } from "../../../../../../../../components/settings/Account/Billing";
import { getValidAccount } from "../../../../../../../account/settings/getAccount";

export default async function Page(props: {
params: Promise<{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getTeamBySlug } from "@/api/team";
import { ChakraProviderSetup } from "@/components/ChakraProviderSetup";
import { redirect } from "next/navigation";
import { getValidAccount } from "../../../../../../account/settings/getAccount";
import { getValidAccount } from "../../../../../../../account/settings/getAccount";
import { SettingsGasCreditsPage } from "./SettingsCreditsPage";

export default async function Page(props: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Toaster } from "@/components/ui/sonner";
import { getThirdwebClient } from "@/constants/thirdweb.server";
import type { Meta, StoryObj } from "@storybook/react";
import { teamStub } from "../../../../../../../stories/stubs";
import { mobileViewport } from "../../../../../../../stories/utils";
import { teamStub } from "../../../../../../../../stories/stubs";
import { mobileViewport } from "../../../../../../../../stories/utils";
import {
DeleteTeamCard,
LeaveTeamCard,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { getThirdwebClient } from "@/constants/thirdweb.server";
import type { Meta, StoryObj } from "@storybook/react";
import { teamStub } from "../../../../../../../stories/stubs";
import { teamStub } from "../../../../../../../../stories/stubs";
import {
BadgeContainer,
mobileViewport,
} from "../../../../../../../stories/utils";
} from "../../../../../../../../stories/utils";
import { TeamSettingsSidebar } from "../_components/sidebar/TeamSettingsSidebar";
import { TeamSettingsMobileNav } from "../_components/sidebar/TeamsMobileNav";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import type { Team } from "@/api/team";
import { API_SERVER_URL } from "@/constants/env";
import { getAuthToken } from "../../../../../../api/lib/getAuthToken";
import { getAuthToken } from "../../../../../../../api/lib/getAuthToken";

export async function updateTeam(params: {
teamId: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getTeamBySlug } from "@/api/team";
import { redirect } from "next/navigation";
import { getValidAccount } from "../../../../../account/settings/getAccount";
import { getValidAccount } from "../../../../../../account/settings/getAccount";
import { SettingsLayout } from "./SettingsLayout";

export default async function Layout(props: {
Expand Down
Loading
Loading