Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Show Action required on keys with legacy partner access

Rafi5ec6dbc7755a
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tokens/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tokens/page.tsx
index 9333de9909..ab0fe2c9be 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tokens/page.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tokens/page.tsx
@@ -1,17 +1,17 @@
"use client";
-import { scopesToName } from "@/lib/api/tokens/scopes";
+import { hasLegacyScopeGrant, scopesToName } from "@/lib/api/tokens/scopes";
import { clientAccessCheck } from "@/lib/client-access-check";
import useWorkspace from "@/lib/swr/use-workspace";
import { TokenProps } from "@/lib/types";
import { PageContent } from "@/ui/layout/page-content";
import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
+import { UserAvatarWithTooltip } from "@/ui/links/link-title-column";
import { useAddEditTokenModal } from "@/ui/modals/add-edit-token-modal";
import { useDeleteTokenModal } from "@/ui/modals/delete-token-modal";
import { useTokenCreatedModal } from "@/ui/modals/token-created-modal";
import { AnimatedEmptyState } from "@/ui/shared/animated-empty-state";
import { Delete } from "@/ui/shared/icons";
-import { UserAvatarWithTooltip } from "@/ui/links/link-title-column";
import {
Button,
buttonVariants,
@@ -32,7 +32,7 @@ import { useState } from "react";
import useSWR from "swr";
export default function TokensPage() {
- const { id: workspaceId, role } = useWorkspace();
+ const { id: workspaceId, role, defaultProgramId } = useWorkspace();
const { pagination, setPagination } = usePagination();
const [createdToken, setCreatedToken] = useState<string | null>(null);
const [selectedToken, setSelectedToken] = useState<TokenProps | null>(null);
@@ -109,7 +109,25 @@ export default function TokensPage() {
id: "permissions",
header: "Permissions",
accessorKey: "scopes",
- cell: ({ row }) => scopesToName(row.original.scopes).name,
+ cell: ({ row }) => (
+ <span className="flex items-center gap-2">
+ {scopesToName(row.original.scopes).name}
+ {defaultProgramId &&
+ hasLegacyScopeGrant({
+ scopes: row.original.scopes,
+ createdAt: row.original.createdAt,
+ }) && (
+ <StatusBadge
+ variant="warning"
+ size="sm"
+ icon={null}
+ tooltip="This key was created before partner program scopes were added, so it can still access partners, commissions, customers and other program data. Create a new key with only the scopes you need, then delete this one."
+ >
+ Action required
+ </StatusBadge>
+ )}
+ </span>
+ ),
},
{
id: "user",