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.

Merge branch 'main' into conversions-ga

Steven Teyf7b6db28eeb0
diff --cc apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/[integrationSlug]/page-client.tsx
index 4448299681,e633a68422..5809125761
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/[integrationSlug]/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/[integrationSlug]/page-client.tsx
@@@ -27,7 -30,15 +30,14 @@@ import
OfficeBuilding,
ShieldCheck,
} from "@dub/ui/icons";
- import { cn, formatDate, getPrettyUrl } from "@dub/utils";
+ import {
+ cn,
+ formatDate,
+ getPrettyUrl,
+ SEGMENT_INTEGRATION_ID,
+ SLACK_INTEGRATION_ID,
- STRIPE_INTEGRATION_ID,
+ ZAPIER_INTEGRATION_ID,
+ } from "@dub/utils";
import { BookOpenText, ChevronLeft, Trash } from "lucide-react";
import { useAction } from "next-safe-action/hooks";
import Link from "next/link";
@@@ -205,28 -224,41 +223,29 @@@ export default function IntegrationPage
Manage
</Link>
)}
- {!integration.installed && (
- <Button
- onClick={() => {
- const { installUrl } = integration;
+ {!integration.installed &&
+ integration.id !== SEGMENT_INTEGRATION_ID && (
+ <Button
+ onClick={() => {
+ const { installUrl } = integration;
- if (installUrl) {
- // open in a new tab
- window.open(installUrl, "_blank");
- return;
- }
+ if (installUrl) {
+ // open in a new tab
+ window.open(installUrl, "_blank");
+ return;
+ }
- getInstallationUrl.execute({
- workspaceId: workspaceId!,
- integrationSlug: integration.slug,
- });
- }}
- loading={getInstallationUrl.isExecuting}
- text="Enable"
- variant="primary"
- icon={<ConnectedDots className="size-4" />}
- />
- )}
+ getInstallationUrl.execute({
+ workspaceId: workspaceId!,
+ integrationSlug: integration.slug,
+ });
+ }}
+ loading={getInstallationUrl.isExecuting}
+ text="Enable"
+ variant="primary"
- className="h-9 px-4"
+ icon={<ConnectedDots className="size-4" />}
- {...(integration.id === STRIPE_INTEGRATION_ID &&
- !conversionEnabled && {
- disabledTooltip: (
- <TooltipContent
- title="To use this integration, you need to have Dub Conversions enabled for your workspace."
- cta="Learn more"
- href="https://d.to/conversions"
- target="_blank"
- />
- ),
- })}
+ />
+ )}
</div>
</div>
diff --cc apps/web/lib/api/rbac/resources.ts
index 1e78582b03,a1d4f2387e..dff9da883d
--- a/apps/web/lib/api/rbac/resources.ts
+++ b/apps/web/lib/api/rbac/resources.ts
@@@ -5,6 -5,8 +5,7 @@@ export const RESOURCE_KEYS =
"domains",
"tags",
"tokens",
- "conversions",
+ "webhooks",
] as const;
export type ResourceKey = (typeof RESOURCE_KEYS)[number];
diff --cc apps/web/lib/api/tokens/scopes.ts
index 4a0da98d11,1a20e0defc..e84de83333
--- a/apps/web/lib/api/tokens/scopes.ts
+++ b/apps/web/lib/api/tokens/scopes.ts
@@@ -13,6 -12,9 +13,8 @@@ export const SCOPES =
"domains.write",
"workspaces.read",
"workspaces.write",
- "conversions.write",
+ "webhooks.read",
+ "webhooks.write",
"apis.all", // All API scopes
"apis.read", // All read scopes
] as const;
@@@ -91,12 -93,26 +93,26 @@@ export const RESOURCE_SCOPES:
resource: "analytics",
},
{
- scope: "conversions.write",
+ scope: "analytics.write",
roles: ["owner", "member"],
- permissions: ["conversions.write"],
+ permissions: ["analytics.write", "analytics.read"],
type: "write",
- resource: "conversions",
+ resource: "analytics",
},
+ {
+ scope: "webhooks.read",
+ roles: ["owner", "member"],
+ permissions: ["webhooks.read"],
+ type: "read",
+ resource: "webhooks",
+ },
+ {
+ scope: "webhooks.write",
+ roles: ["owner"],
+ permissions: ["webhooks.write", "webhooks.read"],
+ type: "write",
+ resource: "webhooks",
+ },
{
scope: "apis.read",
roles: ["owner", "member"],
diff --cc apps/web/ui/modals/add-edit-token-modal.tsx
index 1021e3bd39,9d7e1bfbc8..08e68fcbe2
--- a/apps/web/ui/modals/add-edit-token-modal.tsx
+++ b/apps/web/ui/modals/add-edit-token-modal.tsx
@@@ -135,8 -135,11 +135,11 @@@ function AddEditTokenModal(
(!name || token?.name === name) && token?.scopes === scopes;
const scopesByResources = useMemo(
- () => transformScopesForUI(getScopesByResourceForRole(role)),
+ () =>
- transformScopesForUI(getScopesByResourceForRole(role))
- .filter(({ key }) => key !== "conversions" || conversionEnabled)
- .filter(({ name }) => name),
- [role, conversionEnabled],
++ transformScopesForUI(getScopesByResourceForRole(role)).filter(
++ ({ name }) => name,
++ ),
+ [role],
);
return (