The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Let modifier-clicks open reward URLs and preserve partner overrides on copy
Kiran Kb4dcae79847c
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/rewards/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/rewards/page.tsxindex 583524321f..5df69dcc49 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/rewards/page.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/rewards/page.tsx@@ -212,6 +212,14 @@ const RewardItem = ({)}onClick={(e) => {if (isClickOnInteractiveChild(e)) return;+ if (+ e.metaKey ||+ e.ctrlKey ||+ e.shiftKey ||+ e.altKey ||+ e.button !== 0+ )+ return;e.preventDefault();queryParams({set: {diff --git a/apps/web/lib/sandbox/copy-discount-to-live.ts b/apps/web/lib/sandbox/copy-discount-to-live.tsindex 0f4553e6ea..f8e58ab388 100644--- a/apps/web/lib/sandbox/copy-discount-to-live.ts+++ b/apps/web/lib/sandbox/copy-discount-to-live.ts@@ -158,6 +158,19 @@ export const copyDiscountToLiveAction = authActionClientwhere: {programId: targetProgram.id,groupId: targetGroupId,+ // Inheritors only: no discount yet, or still on a soft-deleted discount+ // owned by this group. Live partner-level overrides stay put.+ OR: [+ { discountId: null },+ {+ discount: {+ is: {+ programId: null,+ groupId: targetGroupId,+ },+ },+ },+ ],},data: {discountId: newDiscount.id,diff --git a/apps/web/lib/sandbox/copy-reward-to-live.ts b/apps/web/lib/sandbox/copy-reward-to-live.tsindex 19b2568af4..98cc4f20c3 100644--- a/apps/web/lib/sandbox/copy-reward-to-live.ts+++ b/apps/web/lib/sandbox/copy-reward-to-live.ts@@ -13,7 +13,10 @@ import { trackRewardActivityLog } from "../api/activity-log/track-reward-activitimport { createId } from "../api/create-id";import { getRewardOrThrow } from "../api/partners/get-reward-or-throw";import { getDefaultProgramIdOrThrow } from "../api/programs/get-default-program-id-or-throw";-import { REWARD_EVENT_COLUMN_MAPPING } from "../zod/schemas/rewards";+import {+ REWARD_EVENT_COLUMN_MAPPING,+ REWARD_EVENT_RELATION_MAPPING,+} from "../zod/schemas/rewards";import { copyRewardToLiveSchema } from "./schemas";export const copyRewardToLiveAction = authActionClient@@ -91,6 +94,7 @@ export const copyRewardToLiveAction = authActionClient});const rewardIdColumn = REWARD_EVENT_COLUMN_MAPPING[reward.event];+ const rewardRelation = REWARD_EVENT_RELATION_MAPPING[reward.event];const newReward = await prisma.$transaction(async (tx) => {const newReward = await tx.reward.create({@@ -135,6 +139,12 @@ export const copyRewardToLiveAction = authActionClientstatus: {notIn: INACTIVE_ENROLLMENT_STATUSES,},+ // Assign only inheritors: no reward yet, or still pointing at a+ // soft-deleted default (programId null).+ OR: [+ { [rewardIdColumn]: null },+ { [rewardRelation]: { is: { programId: null } } },+ ],},data: {[rewardIdColumn]: newReward.id,