The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Merge branch 'main' into program-configuration
Steven Tey26842e6d40c5
diff --cc apps/web/app/app.dub.co/embed/inline/page-client.tsxindex 0c21c42253,34489e0e57..b72a181391--- a/apps/web/app/app.dub.co/embed/inline/page-client.tsx+++ b/apps/web/app/app.dub.co/embed/inline/page-client.tsx@@@ -18,7 -17,9 +18,8 @@@ import { AnimatePresence } from "framerimport { CSSProperties, useState } from "react";import { LinkToken } from "../token";import { EmbedActivity } from "./activity";+ import { EmbedEarnings } from "./earnings";import { EmbedFAQ } from "./faq";-import { HeroBackground } from "./hero-background";import { EmbedLeaderboard } from "./leaderboard";import { EmbedPayouts } from "./payouts";import { EmbedQuickstart } from "./quickstart";diff --cc apps/web/lib/actions/partners/update-program.tsindex 65ac4ca5bd,664788fe1e..b45d988250--- a/apps/web/lib/actions/partners/update-program.ts+++ b/apps/web/lib/actions/partners/update-program.ts@@@ -1,9 -1,7 +1,10 @@@"use server";+ import { getFolderOrThrow } from "@/lib/folder/get-folder-or-throw";+import { isStored, storage } from "@/lib/storage";import { prisma } from "@dub/prisma";+import { nanoid, R2_URL } from "@dub/utils";+import { waitUntil } from "@vercel/functions";import { z } from "zod";import { getProgramOrThrow } from "../../api/programs/get-program-or-throw";import { createProgramSchema } from "../../zod/schemas/programs";@@@ -31,64 -27,35 +33,72 @@@ export const updateProgramAction = authcookieLength,domain,url,+ logo,+ wordmark,+ brandColor,} = parsedInput;- await getProgramOrThrow({- workspaceId: workspace.id,- programId,- });-- if (defaultFolderId) {- await getFolderOrThrow({+ try {+ const program = await getProgramOrThrow({workspaceId: workspace.id,- userId: ctx.user.id,- folderId: defaultFolderId,+ programId,});- }- await prisma.program.update({- where: {- id: programId,- },- data: {- name,- commissionType,- commissionAmount,- commissionDuration,- commissionInterval,- cookieLength,- domain,- url,- defaultFolderId,- },- });++ if (defaultFolderId) {++ await getFolderOrThrow({++ workspaceId: workspace.id,++ userId: ctx.user.id,++ folderId: defaultFolderId,++ });++ }+++ const [logoUrl, wordmarkUrl] = await Promise.all([+ logo && !isStored(logo)+ ? storage+ .upload(`programs/${programId}/logo_${nanoid(7)}`, logo)+ .then(({ url }) => url)+ : null,+ wordmark && !isStored(wordmark)+ ? storage+ .upload(`programs/${programId}/wordmark_${nanoid(7)}`, wordmark)+ .then(({ url }) => url)+ : null,+ ]);++ await prisma.program.update({+ where: {+ id: programId,+ },+ data: {+ name,+ commissionType,+ commissionAmount,+ commissionDuration,+ commissionInterval,+ cookieLength,+ domain,+ url,+ brandColor,+ logo: logoUrl ?? undefined,+ wordmark: wordmarkUrl ?? undefined,+ },+ });++ // Delete old logo/wordmark if they were updated+ waitUntil(+ Promise.all([+ ...(logoUrl && program.logo+ ? [storage.delete(program.logo.replace(`${R2_URL}/`, ""))]+ : []),+ ...(wordmarkUrl && program.wordmark+ ? [storage.delete(program.wordmark.replace(`${R2_URL}/`, ""))]+ : []),+ ]),+ );++ return { ok: true, program };+ } catch (e) {+ console.error("Failed to update program", e);+ return { ok: false };+ }});diff --cc apps/web/lib/middleware/utils/app-redirect.tsindex 8af048a423,a79a699db3..fd27b55f41--- a/apps/web/lib/middleware/utils/app-redirect.ts+++ b/apps/web/lib/middleware/utils/app-redirect.ts@@@ -5,18 -5,8 +5,14 @@@ const APP_REDIRECTS =};export const appRedirect = (path: string) => {- // Use a regex to match both "/settings/library" and "/settings/tags"- const libraryTagsRegex = /\/settings\/(library|tags)$/;- if (libraryTagsRegex.test(path)) {- return path.replace(libraryTagsRegex, "/settings/library/tags");- } else if (APP_REDIRECTS[path]) {+ if (APP_REDIRECTS[path]) {return APP_REDIRECTS[path];}++ // Redirect "programs/[programId]/settings" to "programs/[programId]/settings/rewards" (first tab)+ const programSettingsRegex = /\/programs\/([^\/]+)\/settings$/;+ if (programSettingsRegex.test(path))+ return path.replace(programSettingsRegex, "/programs/$1/settings/rewards");+return null;};diff --cc packages/ui/src/file-upload.tsxindex d7ab0d7d14,2e6cec1b38..3f5792d394--- a/packages/ui/src/file-upload.tsx+++ b/packages/ui/src/file-upload.tsx@@@ -234,10 -228,10 +234,10 @@@ export function FileUpload("opacity-0",showHoverOverlay && !disabled && "group-hover:opacity-100",)- : cn(!disabled && "group-hover:bg-gray-50"),+ : cn(!disabled && "group-hover:bg-neutral-50"),)}>- <CloudUpload+ <IconclassName={cn("size-7 transition-all duration-75",!disabled