Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Create bounty confirmation improvements (#2990)

Tim Wilson99456feb87c6
diff --git a/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts b/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts
index 33e6197a50..c3dd588655 100644
--- a/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts
+++ b/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts
@@ -8,12 +8,11 @@ import { throwIfInvalidGroupIds } from "@/lib/api/groups/throw-if-invalid-group-
import { getDefaultProgramIdOrThrow } from "@/lib/api/programs/get-default-program-id-or-throw";
import { parseRequestBody } from "@/lib/api/utils";
import { withWorkspace } from "@/lib/auth";
-import { qstash } from "@/lib/cron";
import { WorkflowCondition } from "@/lib/types";
import { sendWorkspaceWebhook } from "@/lib/webhook/publish";
import { BountySchema, updateBountySchema } from "@/lib/zod/schemas/bounties";
import { prisma } from "@dub/prisma";
-import { APP_DOMAIN_WITH_NGROK, arrayEqual } from "@dub/utils";
+import { arrayEqual } from "@dub/utils";
import { PartnerGroup, Prisma } from "@prisma/client";
import { waitUntil } from "@vercel/functions";
import { NextResponse } from "next/server";
@@ -215,16 +214,6 @@ export const PATCH = withWorkspace(
trigger: "bounty.updated",
data: updatedBounty,
}),
-
- // if bounty.startsAt was updated, publish a new message to the queue
- updatedBounty.startsAt.getTime() !== bounty.startsAt.getTime() &&
- qstash.publishJSON({
- url: `${APP_DOMAIN_WITH_NGROK}/api/cron/bounties/notify-partners`,
- body: {
- bountyId: updatedBounty.id,
- },
- notBefore: Math.floor(updatedBounty.startsAt.getTime() / 1000),
- }),
]),
);
diff --git a/apps/web/app/(ee)/api/bounties/route.ts b/apps/web/app/(ee)/api/bounties/route.ts
index 9d15317b78..6781c8e6b8 100644
--- a/apps/web/app/(ee)/api/bounties/route.ts
+++ b/apps/web/app/(ee)/api/bounties/route.ts
@@ -9,6 +9,7 @@ import { getProgramEnrollmentOrThrow } from "@/lib/api/programs/get-program-enro
import { parseRequestBody } from "@/lib/api/utils";
import { withWorkspace } from "@/lib/auth";
import { qstash } from "@/lib/cron";
+import { getPlanCapabilities } from "@/lib/plan-capabilities";
import { WorkflowAction } from "@/lib/types";
import { sendWorkspaceWebhook } from "@/lib/webhook/publish";
import {
@@ -159,6 +160,7 @@ export const POST = withWorkspace(
groupIds,
performanceCondition,
performanceScope,
+ sendNotificationEmails,
} = createBountySchema.parse(await parseRequestBody(req));
// Use current date as default if startsAt is not provided
@@ -265,6 +267,8 @@ export const POST = withWorkspace(
const shouldScheduleDraftSubmissions =
bounty.type === "performance" && bounty.performanceScope === "lifetime";
+ const { canSendEmailCampaigns } = getPlanCapabilities(workspace.plan);
+
waitUntil(
Promise.allSettled([
recordAuditLog({
@@ -288,13 +292,15 @@ export const POST = withWorkspace(
data: createdBounty,
}),
- qstash.publishJSON({
- url: `${APP_DOMAIN_WITH_NGROK}/api/cron/bounties/notify-partners`,
- body: {
- bountyId: bounty.id,
- },
- notBefore: Math.floor(bounty.startsAt.getTime() / 1000),
- }),
+ sendNotificationEmails &&
+ canSendEmailCampaigns &&
+ qstash.publishJSON({
+ url: `${APP_DOMAIN_WITH_NGROK}/api/cron/bounties/notify-partners`,
+ body: {
+ bountyId: bounty.id,
+ },
+ notBefore: Math.floor(bounty.startsAt.getTime() / 1000),
+ }),
shouldScheduleDraftSubmissions &&
qstash.publishJSON({
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty-sheet.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty-sheet.tsx
index 0b8a4e63c1..2ddae65358 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty-sheet.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty-sheet.tsx
@@ -1,3 +1,4 @@
+import { generatePerformanceBountyName } from "@/lib/api/bounties/generate-performance-bounty-name";
import { isCurrencyAttribute } from "@/lib/api/workflows/utils";
import { BOUNTY_DESCRIPTION_MAX_LENGTH } from "@/lib/partners/constants";
import { mutatePrefix } from "@/lib/swr/mutate";
@@ -7,7 +8,6 @@ import useWorkspace from "@/lib/swr/use-workspace";
import { BountyProps, BountySubmissionRequirement } from "@/lib/types";
import { createBountySchema } from "@/lib/zod/schemas/bounties";
import { workflowConditionSchema } from "@/lib/zod/schemas/workflows";
-import { useConfirmModal } from "@/ui/modals/confirm-modal";
import { BountyLogic } from "@/ui/partners/bounties/bounty-logic";
import { GroupsMultiSelect } from "@/ui/partners/groups/groups-multi-select";
import {
@@ -40,6 +40,7 @@ import {
} from "react-hook-form";
import { toast } from "sonner";
import { z } from "zod";
+import { useConfirmCreateBountyModal } from "./confirm-create-bounty-modal";
type BountySheetProps = {
setIsOpen: Dispatch<SetStateAction<boolean>>;
@@ -167,6 +168,7 @@ function BountySheetContent({ setIsOpen, bounty }: BountySheetProps) {
name,
description,
performanceCondition,
+ groupIds,
] = watch([
"startsAt",
"endsAt",
@@ -176,6 +178,7 @@ function BountySheetContent({ setIsOpen, bounty }: BountySheetProps) {
"name",
"description",
"performanceCondition",
+ "groupIds",
]);
// Helper functions to update form values
@@ -254,17 +257,6 @@ function BountySheetContent({ setIsOpen, bounty }: BountySheetProps) {
updateSubmissionRequirements(requireImage, checked);
};
- // Confirmation modal for bounty creation only
- const { setShowConfirmModal, confirmModal } = useConfirmModal({
- title: "Confirm bounty creation",
- description:
- "This will create the bounty and notify all partners in the selected partner groups. Are you sure you want to continue?",
- confirmText: "Confirm",
- onConfirm: async () => {
- await performSubmit();
- },
- });
-
// Comprehensive validation logic
const validationError = useMemo(() => {
const now = new Date();
@@ -402,8 +394,35 @@ function BountySheetContent({ setIsOpen, bounty }: BountySheetProps) {
performanceCondition?.value,
]);
+ const { setShowConfirmCreateBountyModal, confirmCreateBountyModal } =
+ useConfirmCreateBountyModal({
+ bounty:
+ !validationError && rewardAmount
+ ? {
+ type,
+ name:
+ type === "performance" && performanceCondition
+ ? generatePerformanceBountyName({
+ rewardAmount: rewardAmount ? rewardAmount * 100 : 0,
+ condition: performanceCondition,
+ })
+ : name || "New bounty",
+ startsAt: startsAt || new Date(),
+ endsAt: endsAt || null,
+ rewardAmount: rewardAmount ? rewardAmount * 100 : null,
+ rewardDescription: rewardDescription || null,
+ groups: groupIds?.map((id) => ({ id })) || [],
+ }
+ : undefined,
+ onConfirm: async ({ sendNotificationEmails }) => {
+ await performSubmit({ sendNotificationEmails });
+ },
+ });
+
// Handle actual form submission (called after confirmation)
- const performSubmit = async () => {
+ const performSubmit = async ({
+ sendNotificationEmails,
+ }: { sendNotificationEmails?: boolean } = {}) => {
if (!workspaceId) return;
const data = form.getValues();
@@ -448,7 +467,7 @@ function BountySheetContent({ setIsOpen, bounty }: BountySheetProps) {
await makeRequest(bounty ? `/api/bounties/${bounty.id}` : "/api/bounties", {
method: bounty ? "PATCH" : "POST",
- body: data,
+ body: { ...data, sendNotificationEmails },
onSuccess: () => {
mutatePrefix("/api/bounties");
setIsOpen(false);
@@ -464,7 +483,7 @@ function BountySheetContent({ setIsOpen, bounty }: BountySheetProps) {
await performSubmit();
} else {
// For creation, show confirmation modal
- setShowConfirmModal(true);
+ setShowConfirmCreateBountyModal(true);
}
});
@@ -927,7 +946,7 @@ function BountySheetContent({ setIsOpen, bounty }: BountySheetProps) {
</div>
</div>
</FormProvider>
- {!bounty && confirmModal}
+ {!bounty && confirmCreateBountyModal}
</form>
);
}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/confirm-create-bounty-modal.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/confirm-create-bounty-modal.tsx
new file mode 100644
index 0000000000..f877b4e77a
--- /dev/null
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/confirm-create-bounty-modal.tsx
@@ -0,0 +1,196 @@
+import { getBountyRewardDescription } from "@/lib/partners/get-bounty-reward-description";
+import { getPlanCapabilities } from "@/lib/plan-capabilities";
+import { usePartnersCountBounty } from "@/lib/swr/use-partners-count-bounty";
+import useWorkspace from "@/lib/swr/use-workspace";
+import { BountyProps } from "@/lib/types";
+import { BountyThumbnailImage } from "@/ui/partners/bounties/bounty-thumbnail-image";
+import {
+ Button,
+ Calendar6,
+ Checkbox,
+ DynamicTooltipWrapper,
+ Gift,
+ Modal,
+ TooltipContent,
+} from "@dub/ui";
+import { formatDate, nFormatter, pluralize } from "@dub/utils";
+import { cn } from "@dub/utils/src";
+import { Dispatch, SetStateAction, useState } from "react";
+
+type ConfirmCreateBountyModalProps = {
+ bounty?: Pick<
+ BountyProps,
+ | "type"
+ | "name"
+ | "startsAt"
+ | "endsAt"
+ | "rewardAmount"
+ | "rewardDescription"
+ | "groups"
+ >;
+ onConfirm: (data: { sendNotificationEmails: boolean }) => Promise<void>;
+};
+
+function ConfirmCreateBountyModal({
+ showConfirmCreateBountyModal,
+ setShowConfirmCreateBountyModal,
+ bounty,
+ onConfirm,
+}: {
+ showConfirmCreateBountyModal: boolean;
+ setShowConfirmCreateBountyModal: Dispatch<SetStateAction<boolean>>;
+} & ConfirmCreateBountyModalProps) {
+ const { plan, slug: workspaceSlug } = useWorkspace();
+ const { canSendEmailCampaigns } = getPlanCapabilities(plan);
+
+ const [isLoading, setIsLoading] = useState(false);
+ const [sendNotificationEmails, setSendNotificationEmails] = useState(
+ canSendEmailCampaigns,
+ );
+
+ const { totalPartnersForBounty, loading } = usePartnersCountBounty({
+ bounty,
+ });
+
+ const handleConfirm = async () => {
+ setIsLoading(true);
+ try {
+ await onConfirm({ sendNotificationEmails });
+ setShowConfirmCreateBountyModal(false);
+ } finally {
+ setIsLoading(false);
+ }
+ };
+
+ return bounty ? (
+ <Modal
+ showModal={showConfirmCreateBountyModal}
+ setShowModal={setShowConfirmCreateBountyModal}
+ >
+ <div className="px-5 py-4 text-left">
+ <h3 className="text-content-emphasis text-base font-semibold">
+ Confirm bounty creation
+ </h3>
+ <p className="text-content-subtle mt-1 text-sm">
+ You are about to create this bounty for the selected partner groups.
+ </p>
+
+ <div className="border-border-default mt-4 flex items-center gap-3 rounded-xl border p-2">
+ <div className="relative flex size-[70px] shrink-0 items-center justify-center rounded-lg bg-neutral-100 p-2">
+ <BountyThumbnailImage bounty={bounty} />
+ </div>
+
+ <div className="flex min-w-0 flex-col gap-1">
+ <h3 className="text-content-emphasis truncate text-sm font-semibold">
+ {bounty.name}
+ </h3>
+
+ <div className="text-content-subtle flex items-center gap-2 text-sm font-medium">
+ <Calendar6 className="size-3.5" />
+ <span>
+ {formatDate(bounty.startsAt, { month: "short" })}
+ {bounty.endsAt && (
+ <>
+ {" → "}
+ {formatDate(bounty.endsAt, { month: "short" })}
+ </>
+ )}
+ </span>
+ </div>
+
+ <div className="text-content-subtle flex items-center gap-2 text-sm font-medium">
+ <Gift className="size-3.5 shrink-0" />
+ <span className="truncate">
+ {getBountyRewardDescription(bounty)}
+ </span>
+ </div>
+ </div>
+ </div>
+
+ <DynamicTooltipWrapper
+ tooltipProps={
+ !canSendEmailCampaigns
+ ? {
+ content: (
+ <TooltipContent
+ title="New bounty notifications are only available on Advanced plans and above."
+ cta="Upgrade to Advanced"
+ href={`/${workspaceSlug}/upgrade`}
+ target="_blank"
+ />
+ ),
+ }
+ : undefined
+ }
+ >
+ <label
+ className={cn(
+ "mt-4 flex items-center gap-2",
+ !canSendEmailCampaigns &&
+ "pointer-events-none cursor-not-allowed",
+ )}
+ >
+ <Checkbox
+ checked={canSendEmailCampaigns ? sendNotificationEmails : false}
+ onCheckedChange={(checked) =>
+ setSendNotificationEmails(Boolean(checked))
+ }
+ disabled={!canSendEmailCampaigns}
+ className="data-[state=checked]:bg-black"
+ />
+ <span
+ className={cn(
+ "text-content-default select-none text-sm font-medium",
+ !canSendEmailCampaigns && "opacity-50",
+ )}
+ >
+ Send notification to{" "}
+ <strong className="text-content-emphasis font-semibold">
+ {loading ? (
+ <span className="inline-block h-4 w-6 animate-pulse rounded bg-neutral-200 align-text-bottom" />
+ ) : (
+ nFormatter(totalPartnersForBounty, { full: true })
+ )}{" "}
+ selected {pluralize("partner", totalPartnersForBounty)}
+ </strong>
+ </span>
+ </label>
+ </DynamicTooltipWrapper>
+ </div>
+
+ <div className="border-border-subtle flex items-center justify-end gap-2 border-t px-5 py-4">
+ <Button
+ variant="secondary"
+ className="h-8 w-fit px-3"
+ text="Cancel"
+ onClick={() => setShowConfirmCreateBountyModal(false)}
+ />
+ <Button
+ variant="primary"
+ className="h-8 w-fit px-3"
+ text="Confirm"
+ loading={isLoading}
+ onClick={handleConfirm}
+ />
+ </div>
+ </Modal>
+ ) : null;
+}
+
+export function useConfirmCreateBountyModal(
+ props: ConfirmCreateBountyModalProps,
+) {
+ const [showConfirmCreateBountyModal, setShowConfirmCreateBountyModal] =
+ useState(false);
+
+ return {
+ setShowConfirmCreateBountyModal,
+ confirmCreateBountyModal: (
+ <ConfirmCreateBountyModal
+ showConfirmCreateBountyModal={showConfirmCreateBountyModal}
+ setShowConfirmCreateBountyModal={setShowConfirmCreateBountyModal}
+ {...props}
+ />
+ ),
+ };
+}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/messages/messages-upsell.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/messages/messages-upsell.tsx
index e8c3000377..ab78d117e0 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/messages/messages-upsell.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/messages/messages-upsell.tsx
@@ -1,13 +1,15 @@
"use client";
-import useWorkspace from "@/lib/swr/use-workspace";
import { PageContent } from "@/ui/layout/page-content";
-import { buttonVariants } from "@dub/ui";
+import { usePartnersUpgradeModal } from "@/ui/partners/partners-upgrade-modal";
+import { Button } from "@dub/ui";
import { cn } from "@dub/utils";
-import Link from "next/link";
export function MessagesUpsell() {
- const { slug } = useWorkspace();
+ const { partnersUpgradeModal, setShowPartnersUpgradeModal } =
+ usePartnersUpgradeModal({
+ plan: "Advanced",
+ });
return (
<PageContent
@@ -18,6 +20,7 @@ export function MessagesUpsell() {
href: "https://dub.co/help/article/messaging-partners",
}}
>
+ {partnersUpgradeModal}
<div className="flex min-h-[calc(100vh-200px)] flex-col items-center justify-center gap-6 overflow-hidden px-4 py-10">
<div className="flex w-full max-w-md flex-col gap-4 [mask-image:linear-gradient(black_60%,transparent)]">
<DemoMessage
@@ -47,15 +50,11 @@ export function MessagesUpsell() {
</p>
</div>
<div className="flex items-center gap-2">
- <Link
- href={`/${slug}/upgrade`}
- className={cn(
- buttonVariants({ variant: "primary" }),
- "flex h-8 items-center justify-center whitespace-nowrap rounded-lg border px-3 text-sm",
- )}
- >
- Upgrade to Advanced
- </Link>
+ <Button
+ onClick={() => setShowPartnersUpgradeModal(true)}
+ text="Upgrade to Advanced"
+ className="h-8 px-3"
+ />
</div>
</div>
</PageContent>
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-help-and-support.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-help-and-support.tsx
index a78eecff9b..6626533cbe 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-help-and-support.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-help-and-support.tsx
@@ -6,6 +6,7 @@ import { getPlanCapabilities } from "@/lib/plan-capabilities";
import useProgram from "@/lib/swr/use-program";
import useWorkspace from "@/lib/swr/use-workspace";
import { ProgramProps } from "@/lib/types";
+import { usePartnersUpgradeModal } from "@/ui/partners/partners-upgrade-modal";
import { Button, CrownSmall, Switch, TooltipContent } from "@dub/ui";
import { useAction } from "next-safe-action/hooks";
import { Controller, useForm } from "react-hook-form";
@@ -44,6 +45,11 @@ export function ProgramHelpAndSupportContent({
}) {
const { id: workspaceId, slug: workspaceSlug, plan } = useWorkspace();
+ const { partnersUpgradeModal, setShowPartnersUpgradeModal } =
+ usePartnersUpgradeModal({
+ plan: "Advanced",
+ });
+
const {
control,
register,
@@ -85,112 +91,114 @@ export function ProgramHelpAndSupportContent({
};
return (
- <form onSubmit={handleSubmit(onSubmit)}>
- <div className="divide-y divide-neutral-200 border-t border-neutral-200 px-6">
- <SettingsRow
- heading="Support Email"
- description="For partner support requests"
- required
- >
- <div className="flex items-center justify-end">
- <div className="w-full max-w-md">
- <input
- type="email"
- className="block w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
- placeholder="[email protected]"
- {...register("supportEmail", {
- required: true,
- })}
- />
+ <>
+ {partnersUpgradeModal}
+ <form onSubmit={handleSubmit(onSubmit)}>
+ <div className="divide-y divide-neutral-200 border-t border-neutral-200 px-6">
+ <SettingsRow
+ heading="Support Email"
+ description="For partner support requests"
+ required
+ >
+ <div className="flex items-center justify-end">
+ <div className="w-full max-w-md">
+ <input
+ type="email"
+ className="block w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
+ placeholder="[email protected]"
+ {...register("supportEmail", {
+ required: true,
+ })}
+ />
+ </div>
</div>
- </div>
- </SettingsRow>
+ </SettingsRow>
- <SettingsRow
- heading="Messaging center"
- description="Communicate with your partners directly inside Dub"
- >
- <div className="flex items-center justify-end">
- <div className="w-full max-w-md">
- <label className="flex items-center gap-3">
- <Controller
- control={control}
- name="messagingEnabledAt"
- render={({ field }) => (
- <Switch
- checked={Boolean(field.value)}
- fn={(checked) =>
- field.onChange(checked ? new Date() : null)
- }
- trackDimensions="radix-state-checked:bg-black focus-visible:ring-black/20"
- disabledTooltip={
- !field.value &&
- !getPlanCapabilities(plan).canMessagePartners ? (
- <TooltipContent
- title="Messaging is only available on Advanced plans and above."
- cta="Upgrade to Advanced"
- href={`/${workspaceSlug}/upgrade`}
- target="_blank"
- />
- ) : undefined
- }
- thumbIcon={
- !getPlanCapabilities(plan).canMessagePartners ? (
- <CrownSmall className="size-full text-neutral-500" />
- ) : undefined
- }
- />
- )}
- />
- <span className="text-content-default text-sm font-medium">
- Enable partner messaging
- </span>
- </label>
+ <SettingsRow
+ heading="Messaging center"
+ description="Communicate with your partners directly inside Dub"
+ >
+ <div className="flex items-center justify-end">
+ <div className="w-full max-w-md">
+ <label className="flex items-center gap-3">
+ <Controller
+ control={control}
+ name="messagingEnabledAt"
+ render={({ field }) => (
+ <Switch
+ checked={Boolean(field.value)}
+ fn={(checked) =>
+ field.onChange(checked ? new Date() : null)
+ }
+ trackDimensions="radix-state-checked:bg-black focus-visible:ring-black/20"
+ disabledTooltip={
+ !field.value &&
+ !getPlanCapabilities(plan).canMessagePartners ? (
+ <TooltipContent
+ title="Messaging is only available on Advanced plans and above."
+ cta="Upgrade to Advanced"
+ onClick={() => setShowPartnersUpgradeModal(true)}
+ />
+ ) : undefined
+ }
+ thumbIcon={
+ !getPlanCapabilities(plan).canMessagePartners ? (
+ <CrownSmall className="size-full text-neutral-500" />
+ ) : undefined
+ }
+ />
+ )}
+ />
+ <span className="text-content-default text-sm font-medium">
+ Enable partner messaging
+ </span>
+ </label>
+ </div>
</div>
- </div>
- </SettingsRow>
+ </SettingsRow>
- <SettingsRow
- heading="Help Center"
- description="Program help articles and documentation"
- >
- <div className="flex items-center justify-end">
- <div className="w-full max-w-md">
- <input
- type="url"
- className="block w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
- {...register("helpUrl")}
- placeholder="https://dub.co/help"
- />
+ <SettingsRow
+ heading="Help Center"
+ description="Program help articles and documentation"
+ >
+ <div className="flex items-center justify-end">
+ <div className="w-full max-w-md">
+ <input
+ type="url"
+ className="block w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
+ {...register("helpUrl")}
+ placeholder="https://dub.co/help"
+ />
+ </div>
</div>
- </div>
- </SettingsRow>
+ </SettingsRow>
- <SettingsRow
- heading="Terms of Service"
- description="Program terms of service and legal information"
- >
- <div className="flex items-center justify-end">
- <div className="w-full max-w-md">
- <input
- type="url"
- className="block w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
- {...register("termsUrl")}
- placeholder="https://dub.co/legal/affiliates"
- />
+ <SettingsRow
+ heading="Terms of Service"
+ description="Program terms of service and legal information"
+ >
+ <div className="flex items-center justify-end">
+ <div className="w-full max-w-md">
+ <input
+ type="url"
+ className="block w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
+ {...register("termsUrl")}
+ placeholder="https://dub.co/legal/affiliates"
+ />
+ </div>
</div>
- </div>
- </SettingsRow>
- </div>
- <div className="flex items-center justify-end gap-2 border-t border-neutral-200 px-6 py-4">
- <Button
- text="Save changes"
- variant="primary"
- className="h-8 w-fit"
- loading={isSubmitting}
- disabled={!isDirty || !isValid}
- />
- </div>
- </form>
+ </SettingsRow>
+ </div>
+ <div className="flex items-center justify-end gap-2 border-t border-neutral-200 px-6 py-4">
+ <Button
+ text="Save changes"
+ variant="primary"
+ className="h-8 w-fit"
+ loading={isSubmitting}
+ disabled={!isDirty || !isValid}
+ />
+ </div>
+ </form>
+ </>
);
}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/integrations/[integrationSlug]/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/integrations/[integrationSlug]/page-client.tsx
index fb77a2560d..25a342025e 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/integrations/[integrationSlug]/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/integrations/[integrationSlug]/page-client.tsx
@@ -272,12 +272,11 @@ export default function IntegrationPageClient({
icon={<ConnectedDots className="size-4" />}
disabledTooltip={
integration.id === HUBSPOT_INTEGRATION_ID &&
- plan !== "business" &&
- plan !== "advanced" &&
- plan !== "enterprise" ? (
+ plan &&
+ ["free", "pro"].includes(plan) ? (
<TooltipContent
- title="Hubspot integration is only available on Advanced plans and above. Upgrade to get started."
- cta="Upgrade to Advanced"
+ title="Hubspot integration is only available on Business plans and above. Upgrade to get started."
+ cta="Upgrade to Business"
href={`/${slug}/settings/billing/upgrade`}
/>
) : null
diff --git a/apps/web/lib/plan-capabilities.ts b/apps/web/lib/plan-capabilities.ts
index cac702949e..74d088aa59 100644
--- a/apps/web/lib/plan-capabilities.ts
+++ b/apps/web/lib/plan-capabilities.ts
@@ -15,6 +15,7 @@ export const getPlanCapabilities = (
canUseAdvancedRewardLogic:
!!plan && ["enterprise", "advanced"].includes(plan),
canMessagePartners: !!plan && ["enterprise", "advanced"].includes(plan),
+ canSendEmailCampaigns: !!plan && ["enterprise", "advanced"].includes(plan),
canDiscoverPartners: !!plan && ["enterprise"].includes(plan),
};
};
diff --git a/apps/web/lib/swr/use-partners-count-bounty.ts b/apps/web/lib/swr/use-partners-count-bounty.ts
index 8179dd7ff1..412caa9ef4 100644
--- a/apps/web/lib/swr/use-partners-count-bounty.ts
+++ b/apps/web/lib/swr/use-partners-count-bounty.ts
@@ -2,7 +2,11 @@ import { useMemo } from "react";
import { BountyProps } from "../types";
import usePartnersCount from "./use-partners-count";
-export function usePartnersCountBounty({ bounty }: { bounty?: BountyProps }) {
+export function usePartnersCountBounty({
+ bounty,
+}: {
+ bounty?: Pick<BountyProps, "groups">;
+}) {
const { partnersCount: groupCount, loading } = usePartnersCount<
| {
groupId: string;
diff --git a/apps/web/lib/zod/schemas/bounties.ts b/apps/web/lib/zod/schemas/bounties.ts
index 0cdfabdedf..f6d13763b9 100644
--- a/apps/web/lib/zod/schemas/bounties.ts
+++ b/apps/web/lib/zod/schemas/bounties.ts
@@ -65,6 +65,7 @@ export const createBountySchema = z.object({
groupIds: z.array(z.string()).nullable(),
performanceCondition: workflowConditionSchema.nullish(),
performanceScope: z.nativeEnum(BountyPerformanceScope).nullish(),
+ sendNotificationEmails: z.boolean().optional(),
});
export const updateBountySchema = createBountySchema
diff --git a/apps/web/ui/partners/partners-upgrade-modal.tsx b/apps/web/ui/partners/partners-upgrade-modal.tsx
index 018056595b..a9b9b88378 100644
--- a/apps/web/ui/partners/partners-upgrade-modal.tsx
+++ b/apps/web/ui/partners/partners-upgrade-modal.tsx
@@ -4,6 +4,7 @@ import {
Check,
Grid,
Modal,
+ PLAN_FEATURE_ICONS,
SimpleTooltipContent,
Switch,
Tooltip,
@@ -75,7 +76,17 @@ export function PartnersUpgradeModal({
},
},
{
- id: "groups",
+ id: "messages",
+ text: "Messaging center",
+ tooltip: {
+ title:
+ "Easily communicate with your partners using our messaging center.",
+ cta: "Learn more.",
+ href: "https://dub.co/help/article/messaging-partners",
+ },
+ },
+ {
+ id: "users",
text: `${plan.limits.groups} partner groups`,
tooltip: {
title:
@@ -101,7 +112,7 @@ export function PartnersUpgradeModal({
],
Enterprise: [
{
- id: "groups",
+ id: "users",
text: "Unlimited partner groups",
},
{
@@ -204,20 +215,27 @@ export function PartnersUpgradeModal({
)}
<div className="mt-6 flex flex-col gap-2 text-sm">
- {features.map(({ id, text, tooltip }) => (
- <li key={id} className="flex items-center gap-2 text-neutral-600">
- <Check className="size-2.5 shrink-0 [&_*]:stroke-2" />
- {tooltip ? (
- <Tooltip content={<SimpleTooltipContent {...tooltip} />}>
- <span className="cursor-help underline decoration-dotted underline-offset-2">
- {text}
- </span>
- </Tooltip>
- ) : (
- <p>{text}</p>
- )}
- </li>
- ))}
+ {features.map(({ id, text, tooltip }) => {
+ const Icon =
+ id && PLAN_FEATURE_ICONS[id] ? PLAN_FEATURE_ICONS[id] : Check;
+ return (
+ <li
+ key={id}
+ className="flex items-center gap-2 text-neutral-600"
+ >
+ <Icon className="size-3 shrink-0 [&_*]:stroke-2" />
+ {tooltip ? (
+ <Tooltip content={<SimpleTooltipContent {...tooltip} />}>
+ <span className="cursor-help underline decoration-dotted underline-offset-2">
+ {text}
+ </span>
+ </Tooltip>
+ ) : (
+ <p>{text}</p>
+ )}
+ </li>
+ );
+ })}
</div>
</div>