The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Add `KeepPartnerInGroupNotice` (#4543)
Steven Tey2c6ec55f595c
diff --git a/apps/web/app/(ee)/app.dub.co/embed/referrals/page-client.tsx b/apps/web/app/(ee)/app.dub.co/embed/referrals/page-client.tsxindex b0f87c52ad..eed976fb78 100644--- a/apps/web/app/(ee)/app.dub.co/embed/referrals/page-client.tsx+++ b/apps/web/app/(ee)/app.dub.co/embed/referrals/page-client.tsx@@ -28,7 +28,7 @@ import {Combobox,Copy,Directions,- Gift,+ DiscountCode,Popover,StatusBadge,TabSelect,@@ -546,7 +546,7 @@ function EmbedRewardsSection({? [{id: "discount",- icon: Gift,+ icon: DiscountCode,text: formatDiscountDescription(resolvedDiscount),},]diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/page-client.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/page-client.tsxindex d3556347b2..95e6a119c6 100644--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/page-client.tsx+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/page-client.tsx@@ -29,7 +29,6 @@ import {buttonVariants,Combobox,CopyText,- Gift,Icon,LinkLogo,StatusBadge,@@ -48,6 +47,7 @@ import {Check,Copy,CursorRays,+ DiscountCode,InvoiceDollar,LoadingSpinner,ReferredVia,@@ -759,7 +759,7 @@ function RewardList() {? [{id: "discount",- icon: Gift,+ icon: DiscountCode,text: formatDiscountDescription(discount),},]diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/discounts/group-discounts.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/discounts/group-discounts.tsxindex 1327399838..c105187588 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/discounts/group-discounts.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/discounts/group-discounts.tsx@@ -10,9 +10,8 @@ import {} from "@/ui/partners/discounts/add-edit-discount-sheet";import { CustomItemsAccordion } from "@/ui/partners/groups/custom-rewards-accordion";import { ProgramRewardDescription } from "@/ui/partners/program-reward-description";-import { Button, useRouterStuff } from "@dub/ui";+import { Button, DiscountCode, useRouterStuff } from "@dub/ui";import { cn, isClickOnInteractiveChild } from "@dub/utils";-import { BadgePercent } from "lucide-react";import Link from "next/link";import { useParams } from "next/navigation";import { useEffect, useState } from "react";@@ -104,7 +103,7 @@ const DiscountItem = ({}}><div className="flex size-10 items-center justify-center rounded-full border border-neutral-200 bg-white">- <BadgePercent className="size-4 text-neutral-600" />+ <DiscountCode className="size-4 text-neutral-600" /></div><div className="flex flex-1 flex-col justify-between gap-y-4 md:flex-row md:items-center"><div className="flex items-center gap-2">diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/group-header.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/group-header.tsxindex 319466b660..06b5ffc5ee 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/group-header.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/group-header.tsx@@ -10,7 +10,7 @@ import {Brush,Button,ChevronRight,- Discount,+ DiscountCode,Gift,Hyperlink,Sliders,@@ -93,7 +93,7 @@ export function GroupHeaderTabs() {{id: "discounts",label: "Discounts",- icon: Discount,+ icon: DiscountCode,external: false,getHref: (group: GroupProps) =>`/${slug}/program/groups/${group.slug}/discounts`,diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/[partnerId]/links/referral-links.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/[partnerId]/links/referral-links.tsxindex 92d40787db..02c135f79c 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/[partnerId]/links/referral-links.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/[partnerId]/links/referral-links.tsx@@ -22,7 +22,6 @@ import {CardList,CopyButton,CursorRays,- Discount,DiscountCode,InvoiceDollar,LoadingSpinner,@@ -32,7 +31,6 @@ import {Tooltip,TooltipContent,UserCheck,- useCopyToClipboard,} from "@dub/ui";import {cn,@@ -417,7 +415,6 @@ function PartnerLinkCard({)}<PartnerLinkCardMenu- partnerLink={partnerLink}overrideDisabledTooltip={overrideDisabledTooltip}onEditReward={(event) => {setRewardEvent(event);@@ -434,18 +431,15 @@ function PartnerLinkCard({}function PartnerLinkCardMenu({- partnerLink,onEditReward,onEditDiscount,overrideDisabledTooltip,}: {- partnerLink: string;onEditReward: (event: "sale" | "lead" | "click") => void;onEditDiscount: () => void;overrideDisabledTooltip?: ReactNode;}) {const [openPopover, setOpenPopover] = useState(false);- const [, copyToClipboard] = useCopyToClipboard();return (<Popover@@ -474,7 +468,7 @@ function PartnerLinkCardMenu({})}<MenuItemas={Command.Item}- icon={Discount}+ icon={DiscountCode}disabledTooltip={overrideDisabledTooltip}onSelect={() => {setOpenPopover(false);diff --git a/apps/web/lib/actions/partners/update-partner-enrollment.ts b/apps/web/lib/actions/partners/update-partner-enrollment.tsindex 5085c2974d..91a6511dc9 100644--- a/apps/web/lib/actions/partners/update-partner-enrollment.ts+++ b/apps/web/lib/actions/partners/update-partner-enrollment.ts@@ -92,6 +92,7 @@ export const updatePartnerEnrollmentAction = authActionClientpartner,tenantId: existingTenantId,groupId,+ groupMoveDisabledAt: existingGroupMoveDisabledAt,clickRewardId: existingClickRewardId,leadRewardId: existingLeadRewardId,saleRewardId: existingSaleRewardId,@@ -137,6 +138,10 @@ export const updatePartnerEnrollmentAction = authActionClient...(leadRewardId !== undefined && { leadRewardId }),...(saleRewardId !== undefined && { saleRewardId }),...(discountId !== undefined && { discountId }),+ ...(hasRewardAssignment(rewardIds) &&+ !existingGroupMoveDisabledAt && {+ groupMoveDisabledAt: new Date(),+ }),};const programEnrollment = await prisma.$transaction(async (tx) => {diff --git a/apps/web/lib/api/partners/update-partner-link.ts b/apps/web/lib/api/partners/update-partner-link.tsindex 0f5e6d54a2..56b51f6a6d 100644--- a/apps/web/lib/api/partners/update-partner-link.ts+++ b/apps/web/lib/api/partners/update-partner-link.ts@@ -91,6 +91,7 @@ export async function updatePartnerLink({select: {groupId: true,discountId: true,+ groupMoveDisabledAt: true,partnerGroup: {select: {clickRewardId: true,@@ -136,6 +137,23 @@ export async function updatePartnerLink({}): null;+ if (+ hasRewardAssignment(linkRewardInput) &&+ !programEnrollment.groupMoveDisabledAt+ ) {+ await prisma.programEnrollment.update({+ where: {+ partnerId_programId: {+ partnerId: link.partnerId,+ programId,+ },+ },+ data: {+ groupMoveDisabledAt: new Date(),+ },+ });+ }+if (body.discountId !== undefined) {await remapDiscountCodesForPartnerJob.dispatch({diff --git a/apps/web/ui/activity-logs/activity-log-registry.tsx b/apps/web/ui/activity-logs/activity-log-registry.tsxindex 6b7564612d..364c40bb17 100644--- a/apps/web/ui/activity-logs/activity-log-registry.tsx+++ b/apps/web/ui/activity-logs/activity-log-registry.tsx@@ -2,8 +2,8 @@ import { ActivityLog, ActivityLogAction } from "@/lib/types";import {CircleDotted,CircleInfo,+ DiscountCode,FileSend,- Gift,MoneyBill2,Pen2,UserArrowRight,@@ -45,9 +45,9 @@ const ACTIVITY_LOG_ICONS: Partial<> = {"partner.groupChanged": UserArrowRight,"partner.rewardChanged": MoneyBill2,- "partner.discountChanged": Gift,+ "partner.discountChanged": DiscountCode,"link.rewardChanged": MoneyBill2,- "link.discountChanged": Gift,+ "link.discountChanged": DiscountCode,...Object.fromEntries(PARTNER_STATUS_ACTIONS.map((action) => [action, CircleDotted]),),diff --git a/apps/web/ui/modals/edit-partner-discount-modal.tsx b/apps/web/ui/modals/edit-partner-discount-modal.tsxindex eb5f9a2d82..d6131f5ddc 100644--- a/apps/web/ui/modals/edit-partner-discount-modal.tsx+++ b/apps/web/ui/modals/edit-partner-discount-modal.tsx@@ -13,11 +13,12 @@ import useWorkspace from "@/lib/swr/use-workspace";import { DiscountProps, EnrolledPartnerProps, GroupProps } from "@/lib/types";import { DiscountSheet } from "@/ui/partners/discounts/add-edit-discount-sheet";import { formatDiscountDescription } from "@/ui/partners/format-discount-description";+import { KeepPartnerInGroupNotice } from "@/ui/partners/keep-partner-in-group-notice";import { PartnerAvatar } from "@/ui/partners/partner-avatar";import { ProgramRewardDescription } from "@/ui/partners/program-reward-description";import { AdditionalRewardOptionList } from "@/ui/partners/rewards/additional-reward-option-list";import { ArrowTurnRight2, Button, Modal } from "@dub/ui";-import { Discount } from "@dub/ui/icons";+import { DiscountCode } from "@dub/ui/icons";import { cn, getPrettyUrl } from "@dub/utils";import { useAction } from "next-safe-action/hooks";import Link from "next/link";@@ -293,7 +294,7 @@ function EditPartnerDiscountModal({type="button"variant="secondary"text="Create discount"- icon={<Discount className="size-4" />}+ icon={<DiscountCode className="size-4" />}className="h-8 w-fit px-3"onClick={() => openDiscountSheet()}/>@@ -338,16 +339,19 @@ function EditPartnerDiscountModal({<div className="flex min-w-0 items-center gap-2"><PartnerAvatar partner={partner} className="size-6 shrink-0" /><div className="min-w-0 leading-tight">- <Link- href={`/${slug}/program/partners/${partner.id}`}- target="_blank"- className={cn(- "block cursor-alias truncate text-xs font-medium text-neutral-900 decoration-dotted hover:underline",- target.type !== "link" && "text-sm",- )}- >- {partner.name}- </Link>+ <div className="flex min-w-0 items-center gap-2">+ <Link+ href={`/${slug}/program/partners/${partner.id}`}+ target="_blank"+ className={cn(+ "min-w-0 cursor-alias truncate text-xs font-medium text-neutral-900 decoration-dotted hover:underline",+ target.type !== "link" && "text-sm",+ )}+ >+ {partner.name}+ </Link>+ <KeepPartnerInGroupNotice offerType="discount" />+ </div>{target.type === "link" && (<Linkhref={`/${slug}/links/${getPrettyUrl(target.link.shortLink)}`}diff --git a/apps/web/ui/modals/edit-partner-reward-modal.tsx b/apps/web/ui/modals/edit-partner-reward-modal.tsxindex 7474119a75..6737646f86 100644--- a/apps/web/ui/modals/edit-partner-reward-modal.tsx+++ b/apps/web/ui/modals/edit-partner-reward-modal.tsx@@ -14,6 +14,7 @@ import { EnrolledPartnerProps, GroupProps, RewardProps } from "@/lib/types";import { REWARD_EVENT_COLUMN_MAPPING } from "@/lib/zod/schemas/rewards";import { useConfirmRewardChangeModal } from "@/ui/modals/confirm-reward-change-modal";import { formatRewardDescription } from "@/ui/partners/format-reward-description";+import { KeepPartnerInGroupNotice } from "@/ui/partners/keep-partner-in-group-notice";import { PartnerAvatar } from "@/ui/partners/partner-avatar";import { ProgramRewardDescription } from "@/ui/partners/program-reward-description";import { RewardSheet } from "@/ui/partners/rewards/add-edit-reward-sheet";@@ -428,16 +429,19 @@ function EditPartnerRewardModal({<div className="flex min-w-0 items-center gap-2"><PartnerAvatar partner={partner} className="size-6 shrink-0" /><div className="min-w-0 leading-tight">- <Link- href={`/${slug}/program/partners/${partner.id}`}- target="_blank"- className={cn(- "block cursor-alias truncate text-xs font-medium text-neutral-900 decoration-dotted hover:underline",- target.type !== "link" && "text-sm",- )}- >- {partner.name}- </Link>+ <div className="flex min-w-0 items-center gap-2">+ <Link+ href={`/${slug}/program/partners/${partner.id}`}+ target="_blank"+ className={cn(+ "min-w-0 cursor-alias truncate text-xs font-medium text-neutral-900 decoration-dotted hover:underline",+ target.type !== "link" && "text-sm",+ )}+ >+ {partner.name}+ </Link>+ <KeepPartnerInGroupNotice offerType="reward" />+ </div>{target.type === "link" && (<Linkhref={`/${slug}/links/${getPrettyUrl(target.link.shortLink)}`}diff --git a/apps/web/ui/partners/discounts/discount-code-tooltip.tsx b/apps/web/ui/partners/discounts/discount-code-tooltip.tsxindex 0fab243a16..15de2c981e 100644--- a/apps/web/ui/partners/discounts/discount-code-tooltip.tsx+++ b/apps/web/ui/partners/discounts/discount-code-tooltip.tsx@@ -1,7 +1,7 @@"use client";import { DiscountProps } from "@/lib/types";-import { Gift, Tooltip } from "@dub/ui";+import { DiscountCode, Tooltip } from "@dub/ui";import { PropsWithChildren } from "react";import { formatDiscountDescription } from "../format-discount-description";@@ -35,7 +35,7 @@ function DiscountCodeTooltipContent({{description && (<div className="p-1"><div className="flex flex-col gap-2 rounded-md border border-neutral-200 bg-neutral-100 p-2">- <Gift className="size-3.5 shrink-0 text-neutral-800" />+ <DiscountCode className="size-3.5 shrink-0 text-neutral-800" /><p className="text-xs font-semibold leading-4 tracking-tight text-neutral-700">{description}</p>diff --git a/apps/web/ui/partners/keep-partner-in-group-notice.tsx b/apps/web/ui/partners/keep-partner-in-group-notice.tsxnew file mode 100644index 0000000000..6b3d8a440d--- /dev/null+++ b/apps/web/ui/partners/keep-partner-in-group-notice.tsx@@ -0,0 +1,23 @@+"use client";++import { Tooltip } from "@dub/ui";+import { Workflow } from "@dub/ui/icons";++export function KeepPartnerInGroupNotice({+ offerType,+}: {+ offerType: "reward" | "discount";+}) {+ return (+ <Tooltip+ content={`When a custom ${offerType} is set, the partner will be kept in their current group so future [group move rules](https://dub.co/help/article/partner-groups#group-move-rules) can't move them and break their custom ${offerType}.`}+ >+ <span+ className="inline-flex shrink-0 cursor-help rounded-md border border-neutral-200 bg-neutral-100 p-0.5 text-neutral-400"+ aria-label="Group move rules disabled"+ >+ <Workflow className="size-3.5" />+ </span>+ </Tooltip>+ );+}diff --git a/apps/web/ui/partners/lander/lander-rewards.tsx b/apps/web/ui/partners/lander/lander-rewards.tsxindex f2a28fb0c9..018c493405 100644--- a/apps/web/ui/partners/lander/lander-rewards.tsx+++ b/apps/web/ui/partners/lander/lander-rewards.tsx@@ -7,7 +7,7 @@ import {GroupBountySummaryProps,RewardProps,} from "@/lib/types";-import { Gift, Heart, Icon, Trophy } from "@dub/ui";+import { DiscountCode, Heart, Icon, Trophy } from "@dub/ui";import { cn } from "@dub/utils";import { PropsWithChildren, useState } from "react";import { formatDiscountDescription } from "../format-discount-description";@@ -72,7 +72,9 @@ export function LanderRewards({))}{discount && (- <Item icon={Gift}>{formatDiscountDescription(discount)}</Item>+ <Item icon={DiscountCode}>+ {formatDiscountDescription(discount)}+ </Item>)}</ul></div>diff --git a/apps/web/ui/partners/program-reward-list.tsx b/apps/web/ui/partners/program-reward-list.tsxindex 58ce6f3609..a3db874c82 100644--- a/apps/web/ui/partners/program-reward-list.tsx+++ b/apps/web/ui/partners/program-reward-list.tsx@@ -2,7 +2,7 @@import { getRewardAmount } from "@/lib/partners/get-reward-amount";import { DiscountProps, RewardProps } from "@/lib/types";-import { Button, Gift, Icon, Tooltip } from "@dub/ui";+import { Button, DiscountCode, Icon, Tooltip } from "@dub/ui";import { cn } from "@dub/utils";import Link from "next/link";import { useParams } from "next/navigation";@@ -108,7 +108,7 @@ export function ProgramRewardList({{discount && (<Item- icon={Gift}+ icon={DiscountCode}iconClassName={iconClassName}overrideTooltip={discount.isOverridediff --git a/apps/web/ui/partners/program-rewards-panel.tsx b/apps/web/ui/partners/program-rewards-panel.tsxindex 8615474b80..0ce19df526 100644--- a/apps/web/ui/partners/program-rewards-panel.tsx+++ b/apps/web/ui/partners/program-rewards-panel.tsx@@ -3,7 +3,7 @@import { constructRewardAmount } from "@/lib/api/sales/construct-reward-amount";import { getRewardAmount } from "@/lib/partners/get-reward-amount";import { DiscountProps, RewardProps } from "@/lib/types";-import { Gift, Tooltip } from "@dub/ui";+import { DiscountCode, Tooltip } from "@dub/ui";import { HelpCircle } from "lucide-react";import { memo } from "react";import { CustomRewardDescription } from "./custom-reward-description";@@ -84,7 +84,7 @@ export const ProgramRewardsPanel = memo(...(discount? [{- icon: Gift,+ icon: DiscountCode,label: formatDiscountDescription(discount),},]diff --git a/apps/web/ui/program-marketplace/program-rewards-display.tsx b/apps/web/ui/program-marketplace/program-rewards-display.tsxindex 4bf02e74fa..a0a8cdfe4c 100644--- a/apps/web/ui/program-marketplace/program-rewards-display.tsx+++ b/apps/web/ui/program-marketplace/program-rewards-display.tsx@@ -2,7 +2,7 @@ import { DiscountProps, RewardProps } from "@/lib/types";import { formatDiscountDescription } from "@/ui/partners/format-discount-description";import { formatRewardDescription } from "@/ui/partners/format-reward-description";import { REWARD_EVENT_ICON } from "@/ui/partners/rewards/reward-event-icon";-import { Gift, Icon } from "@dub/ui";+import { DiscountCode, Icon } from "@dub/ui";import { cn } from "@dub/utils";import * as HoverCard from "@radix-ui/react-hover-card";@@ -72,7 +72,7 @@ export function ProgramRewardsDisplay({items.push({id: "discount",event: "discount",- icon: Gift,+ icon: DiscountCode,description: formatDiscountDescription(discount),onClick: onDiscountClick ? () => onDiscountClick(discount) : undefined,});diff --git a/packages/ui/src/icons/nucleo/discount.tsx b/packages/ui/src/icons/nucleo/discount.tsxdeleted file mode 100644index d8df05f79c..0000000000--- a/packages/ui/src/icons/nucleo/discount.tsx+++ /dev/null@@ -1,37 +0,0 @@-import { SVGProps } from "react";--export function Discount(props: SVGProps<SVGSVGElement>) {- return (- <svg- height="18"- width="18"- viewBox="0 0 18 18"- xmlns="http://www.w3.org/2000/svg"- {...props}- >- <g fill="currentColor">- <path- d="M15.718,8.293l-1.468-1.468v-2.075c0-.552-.448-1-1-1h-2.075l-1.468-1.468c-.391-.39-1.024-.39-1.414,0l-1.468,1.468h-2.075c-.552,0-1,.448-1,1v2.075l-1.468,1.468c-.391,.39-.391,1.024,0,1.414l1.468,1.468v2.075c0,.552,.448,1,1,1h2.075l1.468,1.468c.391,.39,1.024,.39,1.414,0l1.468-1.468h2.075c.552,0,1-.448,1-1v-2.075l1.468-1.468c.391-.39,.391-1.024,0-1.414Z"- fill="none"- stroke="currentColor"- strokeLinecap="round"- strokeLinejoin="round"- strokeWidth="1.5"- />- <circle cx="7" cy="7" fill="currentColor" r="1" stroke="none" />- <circle cx="11" cy="11" fill="currentColor" r="1" stroke="none" />- <line- fill="none"- stroke="currentColor"- strokeLinecap="round"- strokeLinejoin="round"- strokeWidth="1.5"- x1="6.75"- x2="11.25"- y1="11.25"- y2="6.75"- />- </g>- </svg>- );-}diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.tsindex 0f05bd0ce4..909344d4f1 100644--- a/packages/ui/src/icons/nucleo/index.ts+++ b/packages/ui/src/icons/nucleo/index.ts@@ -77,7 +77,6 @@ export * from "./database-key";export * from "./desktop";export * from "./diamond-turn-right";export * from "./directions";-export * from "./discount";export * from "./discount-code";export * from "./dots";export * from "./download";