The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
improved the designs for the integrations page
Steven Tey1788f7478aa8
diff --git a/apps/web/app/api/oauth-apps/[clientId]/route.ts b/apps/web/app/api/integrations/[clientId]/route.tssimilarity index 90%rename from apps/web/app/api/oauth-apps/[clientId]/route.tsrename to apps/web/app/api/integrations/[clientId]/route.tsindex 3ae2dea2d1..54d720249f 100644--- a/apps/web/app/api/oauth-apps/[clientId]/route.ts+++ b/apps/web/app/api/integrations/[clientId]/route.ts@@ -5,7 +5,7 @@ import { prisma } from "@/lib/prisma";import { oAuthAppSchema, updateOAuthAppSchema } from "@/lib/zod/schemas/oauth";import { NextResponse } from "next/server";-// GET /api/oauth-apps/[clientId] – get an OAuth app+// GET /api/integrations/[clientId] – get an integration created by the workspaceexport const GET = withWorkspace(async ({ params, workspace }) => {const app = await prisma.oAuthApp.findFirst({@@ -30,7 +30,7 @@ export const GET = withWorkspace(},);-// PATCH /api/oauth-apps/[clientId] – update an OAuth app+// PATCH /api/integrations/[clientId] – update an integrationexport const PATCH = withWorkspace(async ({ req, params, workspace }) => {const { name, slug, developer, website, redirectUri, logo, pkce } =@@ -60,7 +60,7 @@ export const PATCH = withWorkspace(},);-// DELETE /api/oauth-apps/[clientId] - delete an OAuth app+// DELETE /api/integrations/[clientId] - delete an integrationexport const DELETE = withWorkspace(async ({ params, workspace }) => {const app = await prisma.oAuthApp.findFirst({diff --git a/apps/web/app/api/integrations/installations/[installationId]/route.ts b/apps/web/app/api/integrations/installations/[installationId]/route.tsnew file mode 100644index 0000000000..e1d610f5d0--- /dev/null+++ b/apps/web/app/api/integrations/installations/[installationId]/route.ts@@ -0,0 +1,37 @@+import { withWorkspace } from "@/lib/auth";+import { prisma } from "@/lib/prisma";+import { NextResponse } from "next/server";++// DELETE /api/integrations/installations/[installationId] - Uninstall an integration from the workspace+export const DELETE = withWorkspace(+ async ({ params, workspace, session }) => {+ const uninstalledIntegration = await prisma.oAuthAuthorizedApp.delete({+ where: {+ id: params.installationId,+ },+ select: {+ oAuthApp: {+ select: {+ clientId: true,+ },+ },+ },+ });++ // TODO: refactor to just delete by installationId+ await prisma.restrictedToken.delete({+ where: {+ userId_projectId_clientId: {+ userId: session.user.id,+ projectId: workspace.id,+ clientId: uninstalledIntegration.oAuthApp.clientId,+ },+ },+ });++ return NextResponse.json({ id: params.clientId });+ },+ {+ requiredPermissions: ["integrations.disconnect"],+ },+);diff --git a/apps/web/app/api/oauth-apps/authorized/route.ts b/apps/web/app/api/integrations/installations/route.tssimilarity index 57%rename from apps/web/app/api/oauth-apps/authorized/route.tsrename to apps/web/app/api/integrations/installations/route.tsindex 98f076baed..9fdd13713d 100644--- a/apps/web/app/api/oauth-apps/authorized/route.ts+++ b/apps/web/app/api/integrations/installations/route.ts@@ -2,7 +2,7 @@ import { withWorkspace } from "@/lib/auth";import { prisma } from "@/lib/prisma";import { NextResponse } from "next/server";-// GET /api/oauth-apps/authorized - applications authorized to access workspace resources+// GET /api/integrations/installations - get all installed integrations for a specific workspaceexport const GET = withWorkspace(async ({ workspace }) => {const result = await prisma.oAuthAuthorizedApp.findMany({@@ -31,22 +31,22 @@ export const GET = withWorkspace(},});- const appsAuthorized = result.map((app) => ({- id: app.id,- createdAt: app.createdAt,- clientId: app.oAuthApp.clientId,- name: app.oAuthApp.name,- slug: app.oAuthApp.slug,- developer: app.oAuthApp.developer,- website: app.oAuthApp.website,- logo: app.oAuthApp.logo,+ const installedIntegrations = result.map((integration) => ({+ id: integration.id,+ createdAt: integration.createdAt,+ clientId: integration.oAuthApp.clientId,+ name: integration.oAuthApp.name,+ slug: integration.oAuthApp.slug,+ developer: integration.oAuthApp.developer,+ website: integration.oAuthApp.website,+ logo: integration.oAuthApp.logo,user: {- id: app.user.id,- name: app.user.name,+ id: integration.user.id,+ name: integration.user.name,},}));- return NextResponse.json(appsAuthorized);+ return NextResponse.json(installedIntegrations);},{requiredPermissions: ["integrations.read"],diff --git a/apps/web/app/api/integrations/list/route.ts b/apps/web/app/api/integrations/list/route.tsnew file mode 100644index 0000000000..3d4b6072a8--- /dev/null+++ b/apps/web/app/api/integrations/list/route.ts@@ -0,0 +1,48 @@+import { prisma } from "@/lib/prisma";+import z from "@/lib/zod";+import { oAuthAppSchema } from "@/lib/zod/schemas/oauth";+import { getSearchParams } from "@dub/utils";+import { NextRequest, NextResponse } from "next/server";++// GET /api/integrations/list - get a list of all verified integrations on Dub+export const GET = async (req: NextRequest) => {+ const { page } = getSearchParams(req.url);++ const integrations = await prisma.oAuthApp.findMany({+ where: {+ verified: true,+ },+ include: {+ _count: {+ select: {+ authorizedApps: true,+ },+ },+ },+ take: 50,+ skip: (page ? parseInt(page) : 1 - 1) * 50,+ });++ return NextResponse.json(+ z+ .array(+ oAuthAppSchema+ .omit({+ clientSecret: true,+ redirectUri: true,+ pkce: true,+ })+ .merge(+ z.object({+ installations: z.number(),+ }),+ ),+ )+ .parse(+ integrations.map((integration) => ({+ ...integration,+ installations: integration._count.authorizedApps,+ })),+ ),+ );+};diff --git a/apps/web/app/api/oauth-apps/route.ts b/apps/web/app/api/integrations/route.tssimilarity index 93%rename from apps/web/app/api/oauth-apps/route.tsrename to apps/web/app/api/integrations/route.tsindex f21918b95e..4c4be6226f 100644--- a/apps/web/app/api/oauth-apps/route.ts+++ b/apps/web/app/api/integrations/route.ts@@ -7,7 +7,7 @@ import { createOAuthAppSchema, oAuthAppSchema } from "@/lib/zod/schemas/oauth";import { NextResponse } from "next/server";import { z } from "zod";-// GET /api/oauth-apps - get all OAuth apps for a specific workspace+// GET /api/integrations - get all integrations created by a workspaceexport const GET = withWorkspace(async ({ workspace }) => {const apps = await prisma.oAuthApp.findMany({@@ -24,7 +24,7 @@ export const GET = withWorkspace(},);-// POST /api/oauth-apps - create a new OAuth app+// POST /api/integrations - create a new integrationexport const POST = withWorkspace(async ({ req, workspace, session }) => {const { name, slug, developer, website, redirectUri, logo, pkce } =diff --git a/apps/web/app/api/oauth-apps/[clientId]/disconnect/route.ts b/apps/web/app/api/oauth-apps/[clientId]/disconnect/route.tsdeleted file mode 100644index 6806decdf4..0000000000--- a/apps/web/app/api/oauth-apps/[clientId]/disconnect/route.ts+++ /dev/null@@ -1,31 +0,0 @@-import { withWorkspace } from "@/lib/auth";-import { prisma } from "@/lib/prisma";-import { NextResponse } from "next/server";--// DELETE /api/oauth-apps/[clientId]/disconnect - Disconnect an authorized OAuth app from the workspace-export const DELETE = withWorkspace(- async ({ params, workspace, session }) => {- const prismaArgs = {- userId_projectId_clientId: {- userId: session.user.id,- projectId: workspace.id,- clientId: params.clientId,- },- };-- await prisma.$transaction([- prisma.oAuthAuthorizedApp.delete({- where: prismaArgs,- }),-- prisma.restrictedToken.delete({- where: prismaArgs,- }),- ]);-- return NextResponse.json({ id: params.clientId });- },- {- requiredPermissions: ["integrations.disconnect"],- },-);diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/installed/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/installed/page-client.tsxnew file mode 100644index 0000000000..59b66b2166--- /dev/null+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/installed/page-client.tsx@@ -0,0 +1,3 @@+export default function InstalledIntegrationsPage() {+ return <div>Installed Integrations</div>;+}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/installed/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/installed/page.tsxnew file mode 100644index 0000000000..00063d23aa--- /dev/null+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/installed/page.tsx@@ -0,0 +1,3 @@+export default function InstalledIntegrations() {+ return <div>InstalledIntegrations</div>;+}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/integration-card.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/integration-card.tsxindex 084e88e683..cc0c98503c 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/integration-card.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/integration-card.tsx@@ -1,31 +1,51 @@+import useInstalledIntegrations from "@/lib/swr/use-installed-integrations";import useWorkspace from "@/lib/swr/use-workspace";-import { OAuthAuthorizedAppProps } from "@/lib/types";+import { OAuthAppProps } from "@/lib/types";import { BlurImage, TokenAvatar } from "@dub/ui";import Link from "next/link";-export default function IntegrationCard(app: OAuthAuthorizedAppProps) {+export default function IntegrationCard(app: OAuthAppProps) {const { slug } = useWorkspace();++ const { integrations: installedIntegrations } = useInstalledIntegrations();+ const installed =+ installedIntegrations?.find((i) => i.clientId === app.clientId) || false;+return (<Linkhref={`/${slug}/integrations/${app.slug}`}- className="relative rounded-xl border border-gray-200 bg-white px-5 py-4"+ className="relative rounded-xl border border-gray-200 bg-white px-5 py-4 transition-[filter] hover:[filter:drop-shadow(0_8px_12px_#222A350d)_drop-shadow(0_32px_80px_#2f30370f)]">- <div className="flex items-center space-x-3">- {app.logo ? (- <BlurImage- src={app.logo}- alt={`Logo for ${app.name}`}- className="h-10 w-10 rounded-full border border-gray-200"- width={20}- height={20}- />- ) : (- <TokenAvatar id={app.clientId} />- )}- <div className="flex flex-col space-y-px">- <p className="font-semibold text-gray-700">{app.name}</p>- <p className="text-sm text-gray-500">Installed</p>+ {installed && (+ <p className="absolute right-4 top-4 text-xs text-gray-500">+ INSTALLED+ </p>+ )}+ <div className="flex items-center gap-x-3">+ <div className="rounded-md border border-gray-200 bg-gradient-to-t from-gray-100 p-2">+ {app.logo ? (+ <BlurImage+ src={app.logo}+ alt={`Logo for ${app.name}`}+ className="size-6 rounded-full border border-gray-200"+ width={20}+ height={20}+ />+ ) : (+ <TokenAvatar id={app.clientId} className="size-6" />+ )}</div>+ <p className="font-semibold text-gray-700">{app.name}</p>+ </div>+ <div className="mt-4 grid gap-2">+ <p className="text-sm text-gray-500">+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam,+ quos.+ </p>+ <p className="text-sm text-gray-500">+ Built by{" "}+ <span className="font-medium text-gray-700">{app.developer}</span>+ </p></div></Link>);diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-client.tsxindex 8d46f4d8af..e9149d191a 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-client.tsx@@ -1,7 +1,7 @@"use client";import useWorkspace from "@/lib/swr/use-workspace";-import { OAuthAppProps, OAuthAuthorizedAppProps } from "@/lib/types";+import { OAuthAppProps } from "@/lib/types";import { useAddEditAppModal } from "@/ui/modals/add-edit-oauth-app-modal";import { useAppCreatedModal } from "@/ui/modals/oauth-app-created-modal";import EmptyState from "@/ui/shared/empty-state";@@ -20,14 +20,13 @@ import useSWR from "swr";import IntegrationCard from "./integration-card";export default function IntegrationsPageClient() {- const { id: workspaceId, slug, flags } = useWorkspace();- const { data: apps, isLoading } = useSWR<OAuthAuthorizedAppProps[]>(- `/api/oauth-apps/authorized?workspaceId=${workspaceId}`,+ const { slug, flags } = useWorkspace();++ const { data: allIntegrations, isLoading } = useSWR<OAuthAppProps[]>(+ "/api/integrations/list",fetcher,);- console.log({ apps });-if (!flags?.integrations) {redirect(`/${slug}`);}@@ -78,15 +77,15 @@ export default function IntegrationsPageClient() {</div><MaxWidthWrapper className="flex flex-col gap-3 py-4">- {isLoading || !apps ? (+ {isLoading || !allIntegrations ? (<div className="flex flex-col items-center justify-center space-y-4 py-20"><LoadingSpinner className="h-6 w-6 text-gray-500" /><p className="text-sm text-gray-500">Fetching integrations...</p></div>- ) : apps.length > 0 ? (+ ) : allIntegrations.length > 0 ? (<div className="grid gap-4 sm:grid-cols-3">- {apps.map((app) => (- <IntegrationCard key={app.id} {...app} />+ {allIntegrations.map((app) => (+ <IntegrationCard key={app.clientId} {...app} />))}</div>) : (diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page-client.tsxdeleted file mode 100644index c42bda89ea..0000000000--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page-client.tsx+++ /dev/null@@ -1,229 +0,0 @@-"use client";--import { clientAccessCheck } from "@/lib/api/tokens/permissions";-import useWorkspace from "@/lib/swr/use-workspace";-import { OAuthAppProps } from "@/lib/types";-import { useAddEditAppModal } from "@/ui/modals/add-edit-oauth-app-modal";-import { useDeleteAppModal } from "@/ui/modals/delete-oauth-app-modal";-import { useAppCreatedModal } from "@/ui/modals/oauth-app-created-modal";-import EmptyState from "@/ui/shared/empty-state";-import { CheckCircleFill, Delete } from "@/ui/shared/icons";-import {- BlurImage,- Button,- LoadingSpinner,- Popover,- TokenAvatar,-} from "@dub/ui";-import { Window } from "@dub/ui/src/icons";-import { fetcher } from "@dub/utils";-import { Copy, Edit3, MoreVertical } from "lucide-react";-import { useState } from "react";-import { toast } from "sonner";-import useSWR from "swr";--export default function OAuthAppPageClient() {- const { id: workspaceId, role } = useWorkspace();- const { data: apps, isLoading } = useSWR<OAuthAppProps[]>(- `/api/oauth-apps?workspaceId=${workspaceId}`,- fetcher,- );-- const [app, setApp] = useState<OAuthAppProps | null>(null);- const { AppCreatedModal, setShowAppCreatedModal } = useAppCreatedModal({- app,- });-- const onAppCreated = (app: OAuthAppProps) => {- if (!app) return;-- setApp(app);- setShowAppCreatedModal(true);- };-- const { AddEditAppModal, setShowAddEditAppModal } = useAddEditAppModal({- onAppCreated,- });-- return (- <>- <AppCreatedModal />- <AddEditAppModal />- <div className="rounded-lg border border-gray-200 bg-white">- <div className="flex flex-col items-center justify-between gap-4 space-y-3 p-5 sm:flex-row sm:space-y-0 sm:p-10">- <div className="flex flex-col space-y-3">- <h2 className="text-xl font-medium">OAuth Applications</h2>- <p className="text-sm text-gray-500">- Applications owned by your workspace. You can use OAuth app to- build integrations that extend the Dub's functionality.{" "}- <a- href="https://dub.co/docs/api-reference/tokens"- target="_blank"- className="font-medium underline underline-offset-4 hover:text-black"- >- Learn more- </a>- </p>- </div>- <div className="flex">- <Button- text="Create App"- className="h-9 w-28"- onClick={() => setShowAddEditAppModal(true)}- disabledTooltip={- clientAccessCheck({- action: "oauth_apps.write",- role,- customPermissionDescription: "create OAuth apps",- }).error || undefined- }- />- </div>- </div>- {isLoading || !apps ? (- <div className="flex flex-col items-center justify-center space-y-4 py-20">- <LoadingSpinner className="h-6 w-6 text-gray-500" />- <p className="text-sm text-gray-500">Fetching OAuth apps...</p>- </div>- ) : apps.length > 0 ? (- <div>- <div className="grid grid-cols-5 border-b border-gray-200 px-5 py-2 text-sm font-medium text-gray-500 sm:px-10">- <div className="col-span-3">Name</div>- </div>- <div className="divide-y divide-gray-200">- {apps.map((token) => (- <AppRow key={token.clientId} {...token} />- ))}- </div>- </div>- ) : (- <div className="flex flex-col items-center justify-center gap-y-4 py-20">- <EmptyState- icon={Window}- title="No OAuth Applications found for this workspace"- />- <Button- text="Create App"- className="h-9 w-28"- onClick={() => setShowAddEditAppModal(true)}- disabledTooltip={- clientAccessCheck({- action: "oauth_apps.write",- role,- customPermissionDescription: "create OAuth apps",- }).error || undefined- }- />- </div>- )}- </div>- </>- );-}--const AppRow = (app: OAuthAppProps) => {- const [copiedClientId, setCopiedClientId] = useState(false);- const [openPopover, setOpenPopover] = useState(false);-- const { AddEditAppModal, setShowAddEditAppModal } = useAddEditAppModal({- app,- });-- const { DeleteAppModal, setShowDeleteAppModal } = useDeleteAppModal({- app: {- clientId: app.clientId,- name: app.name,- },- appType: "published",- });-- const copyClientId = () => {- navigator.clipboard.writeText(app.clientId);- setCopiedClientId(true);- toast.success("Client ID copied!");- setTimeout(() => setCopiedClientId(false), 3000);- };-- return (- <>- <AddEditAppModal />- <DeleteAppModal />- <div className="relative grid grid-cols-5 items-center px-5 py-3 sm:px-10">- <div className="col-span-3 flex items-center space-x-3">- {app.logo ? (- <BlurImage- src={app.logo}- alt={`Logo for ${app.name}`}- className="h-10 w-10 rounded-full border border-gray-200"- width={20}- height={20}- />- ) : (- <TokenAvatar id={app.clientId} />- )}- <div className="flex flex-col space-y-px">- <p className="font-semibold text-gray-700">{app.name}</p>- <div className="flex items-center gap-x-2">- <p className="text-sm text-gray-500" suppressHydrationWarning>- {app.developer}- </p>- </div>- </div>- </div>- <Popover- content={- <div className="w-full sm:w-48">- <div className="grid gap-px p-2">- <Button- text="Edit App"- variant="outline"- icon={<Edit3 className="h-4 w-4" />}- className="h-9 justify-start px-2 font-medium"- onClick={() => {- setOpenPopover(false);- setShowAddEditAppModal(true);- }}- />- <Button- text="Copy Client ID"- variant="outline"- icon={- copiedClientId ? (- <CheckCircleFill className="h-4 w-4" />- ) : (- <Copy className="h-4 w-4" />- )- }- className="h-9 justify-start px-2 font-medium"- onClick={() => copyClientId()}- />- <Button- text="Delete App"- variant="danger-outline"- icon={<Delete className="h-4 w-4" />}- className="h-9 justify-start px-2 font-medium"- onClick={() => {- setOpenPopover(false);- setShowDeleteAppModal(true);- }}- />- </div>- </div>- }- align="end"- openPopover={openPopover}- setOpenPopover={setOpenPopover}- >- <button- onClick={() => {- setOpenPopover(!openPopover);- }}- className="absolute right-4 rounded-md px-1 py-2 transition-all duration-75 hover:bg-gray-100 active:bg-gray-200"- >- <MoreVertical className="h-5 w-5 text-gray-500" />- </button>- </Popover>- </div>- </>- );-};diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page.tsxdeleted file mode 100644index 876f72dd84..0000000000--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page.tsx+++ /dev/null@@ -1,5 +0,0 @@-import OAuthAppPageClient from "./page-client";--export default function TokensPage() {- return <OAuthAppPageClient />;-}diff --git a/apps/web/lib/swr/use-created-integrations.ts b/apps/web/lib/swr/use-created-integrations.tsnew file mode 100644index 0000000000..dc0a0f5d0a--- /dev/null+++ b/apps/web/lib/swr/use-created-integrations.ts@@ -0,0 +1,20 @@+import { CreatedIntegrationProps } from "@/lib/types";+import { fetcher } from "@dub/utils";+import useSWR from "swr";+import useWorkspace from "./use-workspace";++export default function useCreatedIntegrations() {+ const { id } = useWorkspace();++ const { data: integrations, isValidating } = useSWR<+ CreatedIntegrationProps[]+ >(id && `/api/integrations?workspaceId=${id}`, fetcher, {+ dedupingInterval: 30000,+ });++ return {+ integrations,+ loading: integrations ? false : true,+ isValidating,+ };+}diff --git a/apps/web/lib/swr/use-installed-integrations.ts b/apps/web/lib/swr/use-installed-integrations.tsnew file mode 100644index 0000000000..50ac54f496--- /dev/null+++ b/apps/web/lib/swr/use-installed-integrations.ts@@ -0,0 +1,20 @@+import { InstalledIntegrationProps } from "@/lib/types";+import { fetcher } from "@dub/utils";+import useSWR from "swr";+import useWorkspace from "./use-workspace";++export default function useInstalledIntegrations() {+ const { id } = useWorkspace();++ const { data: integrations, isValidating } = useSWR<+ InstalledIntegrationProps[]+ >(id && `/api/integrations/installations?workspaceId=${id}`, fetcher, {+ dedupingInterval: 30000,+ });++ return {+ integrations,+ loading: integrations ? false : true,+ isValidating,+ };+}diff --git a/apps/web/lib/types.ts b/apps/web/lib/types.tsindex 40b903152d..e4d49a505b 100644--- a/apps/web/lib/types.ts+++ b/apps/web/lib/types.ts@@ -203,7 +203,9 @@ export type TokenProps = z.infer<typeof tokenSchema>;export type OAuthAppProps = z.infer<typeof oAuthAppSchema>;-export type OAuthAuthorizedAppProps = z.infer<+export type CreatedIntegrationProps = z.infer<typeof oAuthAppSchema>;++export type InstalledIntegrationProps = z.infer<typeof oAuthAuthorizedAppSchema> & {createdAt: string;diff --git a/apps/web/lib/zod/schemas/oauth.ts b/apps/web/lib/zod/schemas/oauth.tsindex c5f748de66..e17c340294 100644--- a/apps/web/lib/zod/schemas/oauth.ts+++ b/apps/web/lib/zod/schemas/oauth.ts@@ -45,11 +45,13 @@ export const oAuthAppSchema = z.object({clientSecret: z.string().optional(),name: z.string(),slug: z.string(),+ description: z.string().nullish(),developer: z.string(),website: z.string(),redirectUri: z.string(),logo: z.string().nullable(),pkce: z.boolean(),+ verified: z.boolean(),});// Schema for OAuth2.0 Authorization requestdiff --git a/apps/web/prisma/schema/oauth.prisma b/apps/web/prisma/schema/oauth.prismaindex d268fd82d1..c599d91620 100644--- a/apps/web/prisma/schema/oauth.prisma+++ b/apps/web/prisma/schema/oauth.prisma@@ -3,12 +3,14 @@ model OAuthApp {clientId String @uniquename Stringslug String @unique+ description String? @db.LongTextdeveloper Stringwebsite StringhashedClientSecret StringredirectUri Stringlogo String?pkce Boolean @default(false)+ verified Boolean @default(false)createdAt DateTime @default(now())updatedAt DateTime @updatedAtuserId String?diff --git a/apps/web/ui/layout/nav-tabs.tsx b/apps/web/ui/layout/nav-tabs.tsxindex ded8d795e6..cfa570f9a1 100644--- a/apps/web/ui/layout/nav-tabs.tsx+++ b/apps/web/ui/layout/nav-tabs.tsx@@ -48,25 +48,29 @@ export default function NavTabs() {scrolled && "sm:translate-x-9",)}>- {tabs.map(({ name, href }) => (- <Link key={href} href={href} className="relative">- <div className="mx-1 my-1.5 rounded-md px-3 py-1.5 transition-all duration-75 hover:bg-gray-100 active:bg-gray-200">- <p className="text-sm text-gray-600 hover:text-black">{name}</p>- </div>- {(pathname === href ||- (href.endsWith("/settings") && pathname?.startsWith(href))) && (- <motion.div- layoutId="indicator"- transition={{- duration: 0.25,- }}- className="absolute bottom-0 w-full px-1.5"- >- <div className="h-0.5 bg-black" />- </motion.div>- )}- </Link>- ))}+ {tabs.map(({ name, href }) => {+ const isActive =+ href === `/${slug}` ? pathname === href : pathname.startsWith(href);++ return (+ <Link key={href} href={href} className="relative">+ <div className="mx-1 my-1.5 rounded-md px-3 py-1.5 transition-all duration-75 hover:bg-gray-100 active:bg-gray-200">+ <p className="text-sm text-gray-600 hover:text-black">{name}</p>+ </div>+ {isActive && (+ <motion.div+ layoutId="indicator"+ transition={{+ duration: 0.25,+ }}+ className="absolute bottom-0 w-full px-1.5"+ >+ <div className="h-0.5 bg-black" />+ </motion.div>+ )}+ </Link>+ );+ })}{slug &&!loading &&!error &&diff --git a/apps/web/ui/modals/add-edit-oauth-app-modal.tsx b/apps/web/ui/modals/add-edit-oauth-app-modal.tsxindex cf7933927f..3ed862692a 100644--- a/apps/web/ui/modals/add-edit-oauth-app-modal.tsx+++ b/apps/web/ui/modals/add-edit-oauth-app-modal.tsx@@ -17,12 +17,14 @@ import { mutate } from "swr";const newApp: OAuthAppProps = {name: "",slug: "",+ description: "",developer: "",website: "",clientId: "",redirectUri: "",logo: null,pkce: false,+ verified: false,};function AddEditAppModal({@@ -45,13 +47,13 @@ function AddEditAppModal({if (app) {return {method: "PATCH",- url: `/api/oauth-apps/${app.clientId}?workspaceId=${workspaceId}`,+ url: `/api/integrations/${app.clientId}?workspaceId=${workspaceId}`,successMessage: "OAuth app updated!",};} else {return {method: "POST",- url: `/api/oauth-apps?workspaceId=${workspaceId}`,+ url: `/api/integrations?workspaceId=${workspaceId}`,successMessage: "OAuth app created!",};}@@ -73,7 +75,7 @@ function AddEditAppModal({const result = await response.json();if (response.ok) {- mutate(`/api/oauth-apps?workspaceId=${workspaceId}`);+ mutate(`/api/integrations?workspaceId=${workspaceId}`);toast.success(endpoint.successMessage);onAppCreated?.(result);setShowAddEditAppModal(false);diff --git a/apps/web/ui/modals/delete-oauth-app-modal.tsx b/apps/web/ui/modals/delete-oauth-app-modal.tsxindex 44e17d3b42..236be08b92 100644--- a/apps/web/ui/modals/delete-oauth-app-modal.tsx+++ b/apps/web/ui/modals/delete-oauth-app-modal.tsx@@ -28,16 +28,16 @@ function DeleteAppModal(props: DeleteAppModalProps) {const action = useMemo(() => {if (appType === "authorized") {return {- url: `/api/oauth-apps/${app.clientId}/disconnect?workspaceId=${workspaceId}`,- mutate: `/api/oauth-apps/authorized?workspaceId=${workspaceId}`,- message: "Successfully disconnected the application!",- title: `Disconnect ${app.name}`,- description: `This will disconnect the application from your workspace. Are you sure you want to continue?`,+ url: `/api/integrations/${app.clientId}/uninstall?workspaceId=${workspaceId}`,+ mutate: `/api/integrations/installations?workspaceId=${workspaceId}`,+ message: "Successfully uninstalled the application!",+ title: `Uninstall ${app.name}`,+ description: `This will uninstall the application from your workspace. Are you sure you want to continue?`,};} else {return {- url: `/api/oauth-apps/${app.clientId}?workspaceId=${workspaceId}`,- mutate: `/api/oauth-apps?workspaceId=${workspaceId}`,+ url: `/api/integrations/${app.clientId}?workspaceId=${workspaceId}`,+ mutate: `/api/integrations?workspaceId=${workspaceId}`,message: "Successfully deleted the application!",title: `Delete ${app.name}`,description: `This will permanently delete the application and revoke all the access tokens associated with it. Are you sure you want to continue?`,diff --git a/packages/ui/src/avatar.tsx b/packages/ui/src/avatar.tsxindex f60047ae44..6780327787 100644--- a/packages/ui/src/avatar.tsx+++ b/packages/ui/src/avatar.tsx@@ -37,12 +37,18 @@ export function Avatar({);}-export function TokenAvatar({ id }: { id: string }) {+export function TokenAvatar({+ id,+ className,+}: {+ id: string;+ className?: string;+}) {return (<imgsrc={`https://api.dicebear.com/7.x/shapes/svg?seed=${id}`}alt="avatar"- className="h-10 w-10 rounded-full"+ className={cn("h-10 w-10 rounded-full", className)}draggable={false}/>);