The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix transformScopesForUI
Steven Tey5827891500d5
diff --git a/apps/web/lib/api/rbac/resources.ts b/apps/web/lib/api/rbac/resources.tsindex 5b4d576a1f..749a2fba07 100644--- a/apps/web/lib/api/rbac/resources.ts+++ b/apps/web/lib/api/rbac/resources.ts@@ -14,42 +14,35 @@ export const RESOURCES: {name: string;key: ResourceKey;description: string;- betaFeature: boolean;}[] = [{name: "Links",key: "links",description: "Create, read, update, and delete links",- betaFeature: false,},{name: "Analytics",key: "analytics",description: "Read analytics",- betaFeature: false,},{name: "Workspaces",key: "workspaces",description: "Read, update, and delete workspaces",- betaFeature: false,},{name: "Domains",key: "domains",description: "Create, read, update, and delete domains",- betaFeature: false,},{name: "Tags",key: "tags",description: "Create, read, update, and delete tags",- betaFeature: false,},{name: "Conversions",key: "conversions",description: "Track conversions (customer, lead, sales)",- betaFeature: true,},];diff --git a/apps/web/ui/modals/add-edit-token-modal.tsx b/apps/web/ui/modals/add-edit-token-modal.tsxindex f63103972b..c31274782c 100644--- a/apps/web/ui/modals/add-edit-token-modal.tsx+++ b/apps/web/ui/modals/add-edit-token-modal.tsx@@ -59,7 +59,14 @@ function AddEditTokenModal({onTokenCreated?: (token: string) => void;}) {const [saving, setSaving] = useState(false);- const { id: workspaceId, logo, slug, role, isOwner, flags } = useWorkspace();+ const {+ id: workspaceId,+ logo,+ slug,+ role,+ isOwner,+ conversionEnabled,+ } = useWorkspace();const [data, setData] = useState<APIKeyProps>(token || newToken);const [preset, setPreset] = useState<ScopePreset>("all_access");@@ -126,10 +133,12 @@ function AddEditTokenModal({const buttonDisabled =(!name || token?.name === name) && token?.scopes === scopes;- const scopesByResources = transformScopesForUI(- getScopesByResourceForRole(role),- ).filter(- ({ key, betaFeature }) => !betaFeature || (flags && flags[key] === true),+ const scopesByResources = useMemo(+ () =>+ transformScopesForUI(getScopesByResourceForRole(role)).filter(+ ({ key }) => key !== "conversions" || conversionEnabled,+ ),+ [role, conversionEnabled],);return (