The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
missed a few more linkTarget → linkScope
Steven Tey39d7de1f36ad
diff --git a/apps/web/app/(ee)/api/cron/streams/send-link-clicked-webhooks/route.ts b/apps/web/app/(ee)/api/cron/streams/send-link-clicked-webhooks/route.tsindex 52d317fe60..62a87c6ed1 100644--- a/apps/web/app/(ee)/api/cron/streams/send-link-clicked-webhooks/route.ts+++ b/apps/web/app/(ee)/api/cron/streams/send-link-clicked-webhooks/route.ts@@ -139,11 +139,11 @@ const processStreamBatch = (): Promise<{const webhooks = workspaces.flatMap((w) => w.webhooks);- const linkTargetWebhookIds = webhooks+ const linkScopeWebhookIds = webhooks.filter((w) => w.linkScope === "links").map((w) => w.id);- const folderTargetWebhookIds = webhooks+ const linkFolderScopeWebhookIds = webhooks.filter((w) => w.linkScope === "folders").map((w) => w.id);@@ -154,11 +154,11 @@ const processStreamBatch = (): Promise<{];const [linkWebhooks, folderWebhooks] = await Promise.all([- linkTargetWebhookIds.length > 0 && linkIds.length > 0+ linkScopeWebhookIds.length > 0 && linkIds.length > 0? prisma.linkWebhook.findMany({where: {webhookId: {- in: linkTargetWebhookIds,+ in: linkScopeWebhookIds,},linkId: {in: linkIds,@@ -171,11 +171,11 @@ const processStreamBatch = (): Promise<{}): Promise.resolve([]),- folderTargetWebhookIds.length > 0 && folderIds.length > 0+ linkFolderScopeWebhookIds.length > 0 && folderIds.length > 0? prisma.folderWebhook.findMany({where: {webhookId: {- in: folderTargetWebhookIds,+ in: linkFolderScopeWebhookIds,},folderId: {in: folderIds,diff --git a/apps/web/app/api/webhooks/[webhookId]/route.ts b/apps/web/app/api/webhooks/[webhookId]/route.tsindex cf53cead20..b1f3e18bbb 100644--- a/apps/web/app/api/webhooks/[webhookId]/route.ts+++ b/apps/web/app/api/webhooks/[webhookId]/route.ts@@ -84,7 +84,7 @@ export const PATCH = withWorkspace(LINK_CLICK_WEBHOOK_TRIGGER,);- const nextLinkTarget = hasLinkClickedTrigger+ const nextLinkScope = hasLinkClickedTrigger? linkScope !== undefined? linkScope: existingWebhook.linkScope@@ -103,11 +103,11 @@ export const PATCH = withWorkspace(...existingWebhook,...input,triggers: finalTriggers,- linkScope: nextLinkTarget,+ linkScope: nextLinkScope,...(hasLinkClickedTrigger &&- nextLinkTarget === "links" && { linkIds: nextLinkIds }),+ nextLinkScope === "links" && { linkIds: nextLinkIds }),...(hasLinkClickedTrigger &&- nextLinkTarget === "folders" && { folderIds: nextFolderIds }),+ nextLinkScope === "folders" && { folderIds: nextFolderIds }),};await validateWebhook({@@ -117,7 +117,7 @@ export const PATCH = withWorkspace(user: session.user,});- const linkTargetChanged = nextLinkTarget !== existingWebhook.linkScope;+ const linkScopeChanged = nextLinkScope !== existingWebhook.linkScope;const shouldSyncLinks =(nextWebhook.linkScope !== "links" && existingLinkIds.length > 0) ||@@ -140,7 +140,7 @@ export const PATCH = withWorkspace(...(name !== undefined && { name }),...(url !== undefined && { url }),...(triggers !== undefined && { triggers }),- ...(linkTargetChanged && { linkScope: nextWebhook.linkScope }),+ ...(linkScopeChanged && { linkScope: nextWebhook.linkScope }),},});diff --git a/apps/web/lib/integrations/common/ui/configure-webhook.tsx b/apps/web/lib/integrations/common/ui/configure-webhook.tsxindex 5e403cb6b6..8d22c5ce1b 100644--- a/apps/web/lib/integrations/common/ui/configure-webhook.tsx+++ b/apps/web/lib/integrations/common/ui/configure-webhook.tsx@@ -139,7 +139,7 @@ export function ConfigureWebhook({availableTriggers={availableTriggers}disabled={!canManageWebhook}webhookId={webhookId}- savedLinkTarget={webhook?.linkScope}+ savedLinkScope={webhook?.linkScope}/></div>diff --git a/apps/web/ui/webhooks/add-edit-webhook-form.tsx b/apps/web/ui/webhooks/add-edit-webhook-form.tsxindex 58c42396ba..144b4b8ee2 100644--- a/apps/web/ui/webhooks/add-edit-webhook-form.tsx+++ b/apps/web/ui/webhooks/add-edit-webhook-form.tsx@@ -143,7 +143,7 @@ export default function AddEditWebhookForm({toast.success(endpoint.successMessage);};- const linkTargetInvalid = isWebhookTriggerSelectionInvalid({+ const linkScopeInvalid = isWebhookTriggerSelectionInvalid({triggers,linkScope: linkScope ?? "workspace",linkIds: linkIds ?? [],@@ -151,7 +151,7 @@ export default function AddEditWebhookForm({});const buttonDisabled =- !name || !url || !triggers.length || isSubmitting || linkTargetInvalid;+ !name || !url || !triggers.length || isSubmitting || linkScopeInvalid;const updateDisabled =(webhook && webhook?.installationId !== null) || permissionsError !== false;@@ -268,7 +268,7 @@ export default function AddEditWebhookForm({availableTriggers={allWebhookTriggers}disabled={updateDisabled}webhookId={webhook?.id}- savedLinkTarget={webhook?.linkScope}+ savedLinkScope={webhook?.linkScope}/></div></div>diff --git a/apps/web/ui/webhooks/webhook-trigger-selector.tsx b/apps/web/ui/webhooks/webhook-trigger-selector.tsxindex 30c6355f65..b1841d1e7b 100644--- a/apps/web/ui/webhooks/webhook-trigger-selector.tsx+++ b/apps/web/ui/webhooks/webhook-trigger-selector.tsx@@ -64,14 +64,14 @@ export function WebhookTriggerSelector({availableTriggers,disabled,webhookId,- savedLinkTarget,+ savedLinkScope,}: {value: WebhookTriggerSelectorValue;onChange: (value: WebhookTriggerSelectorValue) => void;availableTriggers: WebhookTrigger[];disabled?: boolean;webhookId?: string;- savedLinkTarget?: LinkScope | null;+ savedLinkScope?: LinkScope | null;}) {const { id: workspaceId } = useWorkspace();@@ -79,14 +79,14 @@ export function WebhookTriggerSelector({const hasLinkClicked = triggers.includes(LINK_CLICK_WEBHOOK_TRIGGER);const { data: fetchedLinkIds } = useSWR<string[]>(- webhookId && savedLinkTarget === "links"+ webhookId && savedLinkScope === "links"? `/api/webhooks/${webhookId}/links?workspaceId=${workspaceId}`: null,fetcher,);const { data: fetchedFolderIds } = useSWR<string[]>(- webhookId && savedLinkTarget === "folders"+ webhookId && savedLinkScope === "folders"? `/api/webhooks/${webhookId}/folders?workspaceId=${workspaceId}`: null,fetcher,@@ -152,12 +152,12 @@ export function WebhookTriggerSelector({});};- const handleLinkTargetChange = (nextLinkTarget: LinkScope) => {+ const handleLinkScopeChange = (nextLinkScope: LinkScope) => {onChange({...value,- linkScope: nextLinkTarget,- linkIds: nextLinkTarget === "links" ? linkIds : [],- folderIds: nextLinkTarget === "folders" ? folderIds : [],+ linkScope: nextLinkScope,+ linkIds: nextLinkScope === "links" ? linkIds : [],+ folderIds: nextLinkScope === "folders" ? folderIds : [],});};@@ -186,7 +186,7 @@ export function WebhookTriggerSelector({<RadioGroupvalue={linkScope}onValueChange={(nextValue) =>- handleLinkTargetChange(nextValue as LinkScope)+ handleLinkScopeChange(nextValue as LinkScope)}className="flex flex-col gap-2"disabled={disabled}