-
Notifications
You must be signed in to change notification settings - Fork 134
feat: add Dub plugin #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: add Dub plugin #119
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export type DubCredentials = { | ||
| DUB_API_KEY?: string; | ||
| }; |
| 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"/> | ||
| </svg> | ||
| ); | ||
| } | ||
| 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
|
||
| }, | ||
| { | ||
| 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; | ||
There was a problem hiding this comment.
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-ruletofillRuleandclip-ruletoclipRuleto match React's JSX syntax and be consistent with other icon components in the codebase (seeplugins/fal/icon.tsxandplugins/slack/icon.tsx).