Skip to content
Open
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
3 changes: 3 additions & 0 deletions plugins/dub/credentials.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type DubCredentials = {
DUB_API_KEY?: string;
};
14 changes: 14 additions & 0 deletions plugins/dub/icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export function DubIcon({ className }: { className?: string }) {
return (
<svg
aria-label="Dub logo"
className={className}
fill="currentColor"
viewBox="0 0 64 64"
xmlns="http://www.w3.org/2000/svg"
>
<title>Dub</title>
<path fill-rule="evenodd" clip-rule="evenodd" d="M32 64c17.673 0 32-14.327 32-32 0-11.844-6.435-22.186-16-27.719V48h-8v-2.14A15.9 15.9 0 0 1 32 48c-8.837 0-16-7.163-16-16s7.163-16 16-16c2.914 0 5.647.78 8 2.14V1.008A32 32 0 0 0 32 0C14.327 0 0 14.327 0 32s14.327 32 32 32" fill="currentColor"/>
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SVG attributes should use React/JSX camelCase naming convention. Change fill-rule to fillRule and clip-rule to clipRule to match React's JSX syntax and be consistent with other icon components in the codebase (see plugins/fal/icon.tsx and plugins/slack/icon.tsx).

Suggested change
<path fill-rule="evenodd" clip-rule="evenodd" d="M32 64c17.673 0 32-14.327 32-32 0-11.844-6.435-22.186-16-27.719V48h-8v-2.14A15.9 15.9 0 0 1 32 48c-8.837 0-16-7.163-16-16s7.163-16 16-16c2.914 0 5.647.78 8 2.14V1.008A32 32 0 0 0 32 0C14.327 0 0 14.327 0 32s14.327 32 32 32" fill="currentColor"/>
<path fillRule="evenodd" clipRule="evenodd" d="M32 64c17.673 0 32-14.327 32-32 0-11.844-6.435-22.186-16-27.719V48h-8v-2.14A15.9 15.9 0 0 1 32 48c-8.837 0-16-7.163-16-16s7.163-16 16-16c2.914 0 5.647.78 8 2.14V1.008A32 32 0 0 0 32 0C14.327 0 0 14.327 0 32s14.327 32 32 32" fill="currentColor"/>

Copilot uses AI. Check for mistakes.
</svg>
);
}
313 changes: 313 additions & 0 deletions plugins/dub/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,313 @@
import type { IntegrationPlugin } from "../registry";
import { registerIntegration } from "../registry";
import { DubIcon } from "./icon";

const dubPlugin: IntegrationPlugin = {
type: "dub",
label: "Dub",
description: "Create and manage short links",

icon: DubIcon,

formFields: [
{
id: "apiKey",
label: "API Key",
type: "password",
placeholder: "dub_xxx",
configKey: "apiKey",
envVar: "DUB_API_KEY",
helpText: "Get your API key from ",
helpLink: {
text: "Dub Dashboard",
url: "https://app.dub.co/settings/tokens",
},
},
],

testConfig: {
getTestFunction: async () => {
const { testDub } = await import("./test");
return testDub;
},
},

actions: [
{
slug: "create-link",
label: "Create Link",
description: "Create a new short link",
category: "Dub",
stepFunction: "createLinkStep",
stepImportPath: "create-link",
outputFields: [
{ field: "id", description: "Unique link ID" },
{ field: "shortLink", description: "The full short URL" },
{ field: "qrCode", description: "QR code URL for the link" },
{ field: "domain", description: "Short link domain" },
{ field: "key", description: "Short link slug" },
{ field: "url", description: "Destination URL" },
],
configFields: [
{
key: "url",
label: "Destination URL",
type: "template-input",
placeholder: "https://example.com/page",
example: "https://example.com/landing-page",
required: true,
},
{
key: "key",
label: "Custom Slug",
type: "template-input",
placeholder: "my-link",
example: "summer-sale",
},
{
key: "domain",
label: "Domain",
type: "template-input",
placeholder: "dub.sh",
example: "dub.sh",
},
{
label: "Link IDs",
type: "group",
fields: [
{
key: "externalId",
label: "External ID",
type: "template-input",
placeholder: "my-external-id",
},
{
key: "tenantId",
label: "Tenant ID",
type: "template-input",
placeholder: "tenant-123",
},
{
key: "programId",
label: "Program ID",
type: "template-input",
placeholder: "program-123",
},
{
key: "partnerId",
label: "Partner ID",
type: "template-input",
placeholder: "partner-123",
},
],
},
{
label: "Link Preview",
type: "group",
fields: [
{
key: "title",
label: "Title",
type: "template-input",
placeholder: "Custom preview title",
},
{
key: "description",
label: "Description",
type: "template-input",
placeholder: "Custom preview description",
},
{
key: "image",
label: "Image URL",
type: "template-input",
placeholder: "https://example.com/image.png",
},
{
key: "video",
label: "Video URL",
type: "template-input",
placeholder: "https://example.com/video.mp4",
},
],
},
{
label: "UTM Parameters",
type: "group",
fields: [
{
key: "utm_source",
label: "Source",
type: "template-input",
placeholder: "newsletter",
},
{
key: "utm_medium",
label: "Medium",
type: "template-input",
placeholder: "email",
},
{
key: "utm_campaign",
label: "Campaign",
type: "template-input",
placeholder: "summer-sale",
},
{
key: "utm_term",
label: "Term",
type: "template-input",
placeholder: "running+shoes",
},
{
key: "utm_content",
label: "Content",
type: "template-input",
placeholder: "logolink",
},
],
},
],
Comment on lines +51 to +170
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configFields array for "create-link" (lines 51-170) and "upsert-link" (lines 187-306) are identical. Consider extracting this configuration into a shared constant to reduce duplication and ensure consistency. For example: const linkConfigFields = [...] defined once and reused for both actions.

Copilot uses AI. Check for mistakes.
},
{
slug: "upsert-link",
label: "Upsert Link",
description: "Create or update a link by URL or external ID",
category: "Dub",
stepFunction: "upsertLinkStep",
stepImportPath: "upsert-link",
outputFields: [
{ field: "id", description: "Unique link ID" },
{ field: "shortLink", description: "The full short URL" },
{ field: "qrCode", description: "QR code URL for the link" },
{ field: "domain", description: "Short link domain" },
{ field: "key", description: "Short link slug" },
{ field: "url", description: "Destination URL" },
],
configFields: [
{
key: "url",
label: "Destination URL",
type: "template-input",
placeholder: "https://example.com/page",
example: "https://example.com/landing-page",
required: true,
},
{
key: "key",
label: "Custom Slug",
type: "template-input",
placeholder: "my-link",
example: "summer-sale",
},
{
key: "domain",
label: "Domain",
type: "template-input",
placeholder: "dub.sh",
example: "dub.sh",
},
{
label: "Link IDs",
type: "group",
fields: [
{
key: "externalId",
label: "External ID",
type: "template-input",
placeholder: "my-external-id",
},
{
key: "tenantId",
label: "Tenant ID",
type: "template-input",
placeholder: "tenant-123",
},
{
key: "programId",
label: "Program ID",
type: "template-input",
placeholder: "program-123",
},
{
key: "partnerId",
label: "Partner ID",
type: "template-input",
placeholder: "partner-123",
},
],
},
{
label: "Link Preview",
type: "group",
fields: [
{
key: "title",
label: "Title",
type: "template-input",
placeholder: "Custom preview title",
},
{
key: "description",
label: "Description",
type: "template-input",
placeholder: "Custom preview description",
},
{
key: "image",
label: "Image URL",
type: "template-input",
placeholder: "https://example.com/image.png",
},
{
key: "video",
label: "Video URL",
type: "template-input",
placeholder: "https://example.com/video.mp4",
},
],
},
{
label: "UTM Parameters",
type: "group",
fields: [
{
key: "utm_source",
label: "Source",
type: "template-input",
placeholder: "newsletter",
},
{
key: "utm_medium",
label: "Medium",
type: "template-input",
placeholder: "email",
},
{
key: "utm_campaign",
label: "Campaign",
type: "template-input",
placeholder: "summer-sale",
},
{
key: "utm_term",
label: "Term",
type: "template-input",
placeholder: "running+shoes",
},
{
key: "utm_content",
label: "Content",
type: "template-input",
placeholder: "logolink",
},
],
},
],
},
],
};

registerIntegration(dubPlugin);

export default dubPlugin;
Loading