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.

Messaging disabling

Tim Wilsona6adad9eaeb4
diff --git a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/route.ts b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/route.ts
index 3d4277bcb0..2551086838 100644
--- a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/route.ts
+++ b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/route.ts
@@ -1,8 +1,7 @@
import { getProgramEnrollmentOrThrow } from "@/lib/api/programs/get-program-enrollment-or-throw";
import { withPartnerProfile } from "@/lib/auth/partner";
import { sortRewardsByEventOrder } from "@/lib/partners/sort-rewards-by-event-order";
-import { getPlanCapabilities } from "@/lib/plan-capabilities";
-import { PartnerProgramEnrollmentSchema } from "@/lib/zod/schemas/partner-profile";
+import { ProgramEnrollmentSchema } from "@/lib/zod/schemas/programs";
import { Reward } from "@prisma/client";
import { NextResponse } from "next/server";
@@ -28,12 +27,9 @@ export const GET = withPartnerProfile(async ({ partner, params }) => {
);
return NextResponse.json(
- PartnerProgramEnrollmentSchema.parse({
+ ProgramEnrollmentSchema.parse({
...programEnrollment,
rewards,
- messagingEnabled: getPlanCapabilities(
- programEnrollment.program["workspace"].plan,
- ).canMessagePartners,
}),
);
});
diff --git a/apps/web/app/(ee)/api/partner-profile/programs/route.ts b/apps/web/app/(ee)/api/partner-profile/programs/route.ts
index 36d9a99246..363d38d2f2 100644
--- a/apps/web/app/(ee)/api/partner-profile/programs/route.ts
+++ b/apps/web/app/(ee)/api/partner-profile/programs/route.ts
@@ -1,10 +1,7 @@
import { withPartnerProfile } from "@/lib/auth/partner";
import { sortRewardsByEventOrder } from "@/lib/partners/sort-rewards-by-event-order";
-import { getPlanCapabilities } from "@/lib/plan-capabilities";
-import {
- partnerProfileProgramsQuerySchema,
- PartnerProgramEnrollmentSchema,
-} from "@/lib/zod/schemas/partner-profile";
+import { partnerProfileProgramsQuerySchema } from "@/lib/zod/schemas/partner-profile";
+import { ProgramEnrollmentSchema } from "@/lib/zod/schemas/programs";
import { prisma } from "@dub/prisma";
import { Reward } from "@prisma/client";
import { NextResponse } from "next/server";
@@ -56,8 +53,6 @@ export const GET = withPartnerProfile(async ({ partner, searchParams }) => {
const response = programEnrollments.map((enrollment) => {
return {
...enrollment,
- messagingEnabled: getPlanCapabilities(enrollment.program.workspace.plan)
- .canMessagePartners,
rewards: includeRewardsDiscounts
? sortRewardsByEventOrder(
[
@@ -70,7 +65,5 @@ export const GET = withPartnerProfile(async ({ partner, searchParams }) => {
};
});
- return NextResponse.json(
- z.array(PartnerProgramEnrollmentSchema).parse(response),
- );
+ return NextResponse.json(z.array(ProgramEnrollmentSchema).parse(response));
});
diff --git a/apps/web/app/(ee)/api/stripe/webhook/checkout-session-completed.ts b/apps/web/app/(ee)/api/stripe/webhook/checkout-session-completed.ts
index 1a38673aae..407f1b1f19 100644
--- a/apps/web/app/(ee)/api/stripe/webhook/checkout-session-completed.ts
+++ b/apps/web/app/(ee)/api/stripe/webhook/checkout-session-completed.ts
@@ -1,6 +1,7 @@
import { claimDotLinkDomain } from "@/lib/api/domains/claim-dot-link-domain";
import { inviteUser } from "@/lib/api/users";
import { tokenCache } from "@/lib/auth/token-cache";
+import { getPlanCapabilities } from "@/lib/plan-capabilities";
import { stripe } from "@/lib/stripe";
import { WorkspaceProps } from "@/lib/types";
import { redis } from "@/lib/upstash";
@@ -72,6 +73,8 @@ export async function checkoutSessionCompleted(event: Stripe.Event) {
paymentFailedAt: null,
},
select: {
+ plan: true,
+ defaultProgramId: true,
users: {
select: {
user: {
@@ -139,6 +142,21 @@ export async function checkoutSessionCompleted(event: Stripe.Event) {
tokenCache.expireMany({
hashedKeys: workspace.restrictedTokens.map(({ hashedKey }) => hashedKey),
}),
+
+ // enable program messaging if available
+ ...(workspace.defaultProgramId &&
+ getPlanCapabilities(workspace.plan).canMessagePartners
+ ? [
+ prisma.program.update({
+ where: {
+ id: workspace.defaultProgramId,
+ },
+ data: {
+ messagingEnabledAt: new Date(),
+ },
+ }),
+ ]
+ : []),
]);
}
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/messages/[programSlug]/page-client.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/messages/[programSlug]/page-client.tsx
index 5f0b44d6e1..568fd26864 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/messages/[programSlug]/page-client.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/messages/[programSlug]/page-client.tsx
@@ -62,7 +62,7 @@ export function PartnerMessagesProgramPageClient() {
mutate: mutateProgramMessages,
} = useProgramMessages({
query: { programSlug, sortOrder: "asc" },
- enabled: programEnrollment?.messagingEnabled ?? false,
+ enabled: Boolean(programEnrollment?.program?.messagingEnabledAt),
swrOpts: {
onSuccess: async (data) => {
// Mark unread messages from the program as read
@@ -137,8 +137,7 @@ export function PartnerMessagesProgramPageClient() {
onClick={() => setIsRightPanelOpen((o) => !o)}
/>
</div>
- {programEnrollment?.messagingEnabled === false ||
- program?.slug === "framer" ? ( // TODO: this is a temp fix, we should remove once we add it to the program level
+ {programEnrollment?.program?.messagingEnabledAt === null ? ( // TODO: this is a temp fix, we should remove once we add it to the program level
<div className="flex size-full flex-col items-center justify-center px-4">
<MsgsDotted className="size-10 text-neutral-700" />
<div className="mt-6 max-w-md text-center">
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/messages/layout.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/messages/layout.tsx
index 2697763e6e..371fcd62c7 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/messages/layout.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/messages/layout.tsx
@@ -2,7 +2,9 @@
import { getPlanCapabilities } from "@/lib/plan-capabilities";
import { usePartnerMessages } from "@/lib/swr/use-partner-messages";
+import useProgram from "@/lib/swr/use-program";
import useWorkspace from "@/lib/swr/use-workspace";
+import LayoutLoader from "@/ui/layout/layout-loader";
import { NavButton } from "@/ui/layout/page-content/nav-button";
import { MessagesContext, MessagesPanel } from "@/ui/messages/messages-context";
import { MessagesList } from "@/ui/messages/messages-list";
@@ -11,15 +13,20 @@ import { Button } from "@dub/ui";
import { Msgs, Pen2 } from "@dub/ui/icons";
import { useParams, useRouter } from "next/navigation";
import { CSSProperties, ReactNode, useState } from "react";
+import { MessagesDisabled } from "./messages-disabled";
import { MessagesUpsell } from "./messages-upsell";
export default function MessagesLayout({ children }: { children: ReactNode }) {
const { plan } = useWorkspace();
+ const { program, loading } = useProgram();
- const { canMessagePartners } = getPlanCapabilities(plan);
+ if (loading) return <LayoutLoader />;
+ const { canMessagePartners } = getPlanCapabilities(plan);
if (!canMessagePartners) return <MessagesUpsell />;
+ if (program?.messagingEnabledAt === null) return <MessagesDisabled />;
+
return <CapableLayout>{children}</CapableLayout>;
}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/messages/messages-disabled.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/messages/messages-disabled.tsx
new file mode 100644
index 0000000000..578a884d23
--- /dev/null
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/messages/messages-disabled.tsx
@@ -0,0 +1,45 @@
+"use client";
+
+import useWorkspace from "@/lib/swr/use-workspace";
+import { PageContent } from "@/ui/layout/page-content";
+import { MsgsDotted, buttonVariants } from "@dub/ui";
+import { cn } from "@dub/utils";
+import Link from "next/link";
+
+export function MessagesDisabled() {
+ const { slug } = useWorkspace();
+
+ return (
+ <PageContent title="Messages">
+ <div className="flex min-h-[calc(100vh-200px)] flex-col items-center justify-center gap-6 overflow-hidden px-4 py-10">
+ <MsgsDotted className="text-content-subtle size-10" />
+ <div className="max-w-80 text-pretty text-center">
+ <span className="text-base font-medium text-neutral-900">
+ Messaging disabled
+ </span>
+ <p className="mt-2 text-pretty text-sm text-neutral-500">
+ Enable messaging in your{" "}
+ <Link
+ href={`/${slug}/program/resources`}
+ className="hover:text-content-default underline underline-offset-2"
+ >
+ Resources
+ </Link>{" "}
+ to message your partners.
+ </p>
+ </div>
+ <div className="flex items-center gap-2">
+ <Link
+ href={`/${slug}/program/resources`}
+ className={cn(
+ buttonVariants({ variant: "secondary" }),
+ "flex h-9 items-center justify-center whitespace-nowrap rounded-lg border px-4 text-sm font-medium",
+ )}
+ >
+ View resources
+ </Link>
+ </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 cd9d8ad241..cad7b9315c 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
@@ -2,23 +2,50 @@
import { parseActionError } from "@/lib/actions/parse-action-errors";
import { updateProgramAction } from "@/lib/actions/partners/update-program";
+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 { Button } from "@dub/ui";
+import { Button, CrownSmall, Switch, TooltipContent } from "@dub/ui";
import { useAction } from "next-safe-action/hooks";
-import { useForm } from "react-hook-form";
+import { Controller, useForm } from "react-hook-form";
import { toast } from "sonner";
import { mutate } from "swr";
import { SettingsRow } from "../program-settings-row";
-type FormData = Pick<ProgramProps, "supportEmail" | "helpUrl" | "termsUrl">;
+type FormData = Pick<
+ ProgramProps,
+ "supportEmail" | "helpUrl" | "termsUrl" | "messagingEnabledAt"
+>;
export function ProgramHelpAndSupport() {
const { program } = useProgram();
- const { id: workspaceId } = useWorkspace();
+
+ return (
+ <div className="rounded-lg border border-neutral-200 bg-white">
+ <div className="p-6">
+ <h2 className="inline-flex items-center gap-2 text-lg font-semibold text-neutral-900">
+ Help and Support
+ </h2>
+ <p className="mt-1 text-sm text-neutral-600">
+ Configure the support email, help center, and terms of service for
+ your program.
+ </p>
+ </div>
+ <ProgramHelpAndSupportContent key={program?.id} program={program} />
+ </div>
+ );
+}
+
+export function ProgramHelpAndSupportContent({
+ program,
+}: {
+ program?: ProgramProps;
+}) {
+ const { id: workspaceId, slug: workspaceSlug, plan } = useWorkspace();
const {
+ control,
register,
handleSubmit,
formState: { isDirty, isValid, isSubmitting },
@@ -28,6 +55,7 @@ export function ProgramHelpAndSupport() {
supportEmail: program?.supportEmail,
helpUrl: program?.helpUrl,
termsUrl: program?.termsUrl,
+ messagingEnabledAt: program?.messagingEnabledAt,
},
});
@@ -58,78 +86,104 @@ export function ProgramHelpAndSupport() {
return (
<form onSubmit={handleSubmit(onSubmit)}>
- <div className="rounded-lg border border-neutral-200 bg-white">
- <div className="p-6">
- <h2 className="inline-flex items-center gap-2 text-lg font-semibold text-neutral-900">
- Help and Support
- </h2>
- <p className="mt-1 text-sm text-neutral-600">
- Configure the support email, help center, and terms of service for
- your program.
- </p>
- </div>
-
- <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 className="divide-y divide-neutral-200 border-t border-neutral-200 px-6">
+ <SettingsRow
+ heading="Platform messages"
+ description="Communicate with your partners in Dub"
+ >
+ <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
+ }
/>
- </div>
+ )}
+ />
+ <span className="text-content-default text-sm font-medium">
+ Enable partner messaging
+ </span>
+ </label>
+ </SettingsRow>
+
+ <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>
- </SettingsRow>
+ </div>
+ </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"
- />
- </div>
+ <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>
- </SettingsRow>
+ </div>
+ </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"
- />
- </div>
+ <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>
- </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>
+ </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>
);
diff --git a/apps/web/lib/actions/partners/create-program.ts b/apps/web/lib/actions/partners/create-program.ts
index 6255ead72d..0258aa7796 100644
--- a/apps/web/lib/actions/partners/create-program.ts
+++ b/apps/web/lib/actions/partners/create-program.ts
@@ -2,6 +2,7 @@ import { recordAuditLog } from "@/lib/api/audit-logs/record-audit-log";
import { createId } from "@/lib/api/create-id";
import { getDomainOrThrow } from "@/lib/api/domains/get-domain-or-throw";
import { createAndEnrollPartner } from "@/lib/api/partners/create-and-enroll-partner";
+import { getPlanCapabilities } from "@/lib/plan-capabilities";
import { isStored, storage } from "@/lib/storage";
import { PlanProps } from "@/lib/types";
import { DEFAULT_PARTNER_GROUP } from "@/lib/zod/schemas/groups";
@@ -98,6 +99,10 @@ export const createProgram = async ({
supportEmail,
helpUrl,
termsUrl,
+ messagingEnabledAt: getPlanCapabilities(workspace.plan)
+ .canMessagePartners
+ ? new Date()
+ : null,
...(type &&
amount && {
rewards: {
diff --git a/apps/web/lib/actions/partners/update-program.ts b/apps/web/lib/actions/partners/update-program.ts
index c27e7be43b..aebded42ef 100644
--- a/apps/web/lib/actions/partners/update-program.ts
+++ b/apps/web/lib/actions/partners/update-program.ts
@@ -2,6 +2,7 @@
import { recordAuditLog } from "@/lib/api/audit-logs/record-audit-log";
import { getDefaultProgramIdOrThrow } from "@/lib/api/programs/get-default-program-id-or-throw";
+import { getPlanCapabilities } from "@/lib/plan-capabilities";
import { isStored, storage } from "@/lib/storage";
import { ProgramLanderData } from "@/lib/types";
import {
@@ -47,6 +48,7 @@ export const updateProgramAction = authActionClient
holdingPeriodDays,
minPayoutAmount,
cookieLength,
+ messagingEnabledAt,
} = parsedInput;
const programId = getDefaultProgramIdOrThrow(workspace);
@@ -91,6 +93,9 @@ export const updateProgramAction = authActionClient
cookieLength,
holdingPeriodDays,
minPayoutAmount,
+ ...(messagingEnabledAt !== undefined &&
+ (getPlanCapabilities(workspace.plan).canMessagePartners ||
+ messagingEnabledAt === null) && { messagingEnabledAt }),
},
});
diff --git a/apps/web/lib/api/audit-logs/schemas.ts b/apps/web/lib/api/audit-logs/schemas.ts
index 3f164c6775..609b02782b 100644
--- a/apps/web/lib/api/audit-logs/schemas.ts
+++ b/apps/web/lib/api/audit-logs/schemas.ts
@@ -101,6 +101,7 @@ export const auditLogTarget = z.union([
holdingPeriodDays: true,
minPayoutAmount: true,
autoApprovePartnersEnabledAt: true,
+ messagingEnabledAt: true,
}).optional(),
}),
diff --git a/apps/web/lib/swr/use-program-enrollment.ts b/apps/web/lib/swr/use-program-enrollment.ts
index 6ca3ed2c6b..dccc4bd20f 100644
--- a/apps/web/lib/swr/use-program-enrollment.ts
+++ b/apps/web/lib/swr/use-program-enrollment.ts
@@ -2,7 +2,7 @@ import { fetcher } from "@dub/utils";
import { useSession } from "next-auth/react";
import { useParams } from "next/navigation";
import useSWR, { SWRConfiguration } from "swr";
-import { PartnerProgramEnrollmentProps } from "../types";
+import { ProgramEnrollmentProps } from "../types";
export default function useProgramEnrollment({
swrOpts,
@@ -18,7 +18,7 @@ export default function useProgramEnrollment({
data: programEnrollment,
error,
isLoading,
- } = useSWR<PartnerProgramEnrollmentProps>(
+ } = useSWR<ProgramEnrollmentProps>(
partnerId && programSlug
? `/api/partner-profile/programs/${programSlug}`
: undefined,
diff --git a/apps/web/lib/types.ts b/apps/web/lib/types.ts
index 97bc8162d1..10f262ea05 100644
--- a/apps/web/lib/types.ts
+++ b/apps/web/lib/types.ts
@@ -4,7 +4,6 @@ import {
PartnerEarningsSchema,
PartnerProfileCustomerSchema,
PartnerProfileLinkSchema,
- PartnerProgramEnrollmentSchema,
} from "@/lib/zod/schemas/partner-profile";
import { DirectorySyncProviders } from "@boxyhq/saml-jackson";
import {
@@ -452,10 +451,6 @@ export type PartnerProgramInviteProps = z.infer<
export type ProgramEnrollmentProps = z.infer<typeof ProgramEnrollmentSchema>;
-export type PartnerProgramEnrollmentProps = z.infer<
- typeof PartnerProgramEnrollmentSchema
->;
-
export type PayoutsCount = {
status: PayoutStatus;
count: number;
diff --git a/apps/web/lib/zod/schemas/partner-profile.ts b/apps/web/lib/zod/schemas/partner-profile.ts
index 1491220199..b1f0e41d47 100644
--- a/apps/web/lib/zod/schemas/partner-profile.ts
+++ b/apps/web/lib/zod/schemas/partner-profile.ts
@@ -14,7 +14,6 @@ import {
import { customerActivityResponseSchema } from "./customer-activity";
import { CustomerEnrichedSchema } from "./customers";
import { LinkSchema } from "./links";
-import { ProgramEnrollmentSchema } from "./programs";
import { workflowConditionSchema } from "./workflows";
export const PartnerEarningsSchema = CommissionSchema.omit({
@@ -128,10 +127,6 @@ export const partnerProfileProgramsQuerySchema = z.object({
status: z.nativeEnum(ProgramEnrollmentStatus).optional(),
});
-export const PartnerProgramEnrollmentSchema = ProgramEnrollmentSchema.extend({
- messagingEnabled: z.boolean(),
-});
-
export const partnerProfileProgramsCountQuerySchema =
partnerProfileProgramsQuerySchema.pick({ status: true });
diff --git a/apps/web/lib/zod/schemas/programs.ts b/apps/web/lib/zod/schemas/programs.ts
index 46c1e622b5..c3ba5b0619 100644
--- a/apps/web/lib/zod/schemas/programs.ts
+++ b/apps/web/lib/zod/schemas/programs.ts
@@ -31,6 +31,7 @@ export const ProgramSchema = z.object({
minPayoutAmount: z.number(),
landerPublishedAt: z.date().nullish(),
autoApprovePartnersEnabledAt: z.date().nullish(),
+ messagingEnabledAt: z.date().nullish(),
rewards: z.array(RewardSchema).nullish(),
discounts: z.array(DiscountSchema).nullish(),
defaultFolderId: z.string(),
@@ -67,6 +68,7 @@ export const updateProgramSchema = z.object({
supportEmail: z.string().email().max(255).nullish(),
helpUrl: z.string().url().max(500).nullish(),
termsUrl: z.string().url().max(500).nullish(),
+ messagingEnabledAt: z.coerce.date().nullish(),
});
export const ProgramPartnerLinkSchema = LinkSchema.pick({
diff --git a/packages/prisma/schema/program.prisma b/packages/prisma/schema/program.prisma
index 62e4ad351c..ea19cde041 100644
--- a/packages/prisma/schema/program.prisma
+++ b/packages/prisma/schema/program.prisma
@@ -50,6 +50,7 @@ model Program {
supportEmail String?
ageVerification Int?
autoApprovePartnersEnabledAt DateTime?
+ messagingEnabledAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
diff --git a/packages/ui/src/content.ts b/packages/ui/src/content.ts
index 3fbf79b3a2..7ba2fb9d87 100644
--- a/packages/ui/src/content.ts
+++ b/packages/ui/src/content.ts
@@ -11,7 +11,7 @@ import {
FeatherFill,
Github,
Go,
- LifeRing,
+ LifeRingFill,
LinkedIn,
MicrophoneFill,
Php,
@@ -139,7 +139,7 @@ export const SOLUTIONS: NavItemChildren = [
export const RESOURCES = [
{
- icon: LifeRing,
+ icon: LifeRingFill,
title: "Help Center",
description: "Answers to your questions",
href: "/help",
diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.ts
index 29b39d8668..7387781182 100644
--- a/packages/ui/src/icons/nucleo/index.ts
+++ b/packages/ui/src/icons/nucleo/index.ts
@@ -141,6 +141,7 @@ export * from "./key";
export * from "./layout-sidebar";
export * from "./license";
export * from "./life-ring";
+export * from "./life-ring-fill";
export * from "./lines-y";
export * from "./link-broken";
export * from "./link4";
diff --git a/packages/ui/src/icons/nucleo/life-ring-fill.tsx b/packages/ui/src/icons/nucleo/life-ring-fill.tsx
new file mode 100644
index 0000000000..e0cfffc104
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/life-ring-fill.tsx
@@ -0,0 +1,64 @@
+import { SVGProps } from "react";
+
+export function LifeRingFill(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="M6.188,7.951l-1.404-.525c.457-1.223,1.42-2.186,2.643-2.643l.525,1.405c-.815,.305-1.458,.947-1.764,1.763Z"
+ fill="currentColor"
+ />
+ <path
+ d="M11.812,7.951c-.306-.815-.948-1.458-1.764-1.763l.525-1.405c1.223,.457,2.186,1.42,2.643,2.643l-1.404,.525Z"
+ fill="currentColor"
+ />
+ <path
+ d="M10.574,13.217l-.525-1.405c.815-.305,1.458-.947,1.764-1.763l1.404,.525c-.457,1.223-1.42,2.186-2.643,2.643Z"
+ fill="currentColor"
+ />
+ <path
+ d="M7.426,13.217c-1.223-.457-2.186-1.42-2.643-2.643l1.404-.525c.306,.815,.948,1.458,1.764,1.763l-.525,1.405Z"
+ fill="currentColor"
+ />
+ <path
+ d="M6.202,16.497c-2.174-.812-3.887-2.524-4.698-4.699l1.404-.524c.66,1.767,2.052,3.159,3.819,3.818l-.525,1.405Z"
+ fill="currentColor"
+ />
+ <path
+ d="M11.798,16.497l-.525-1.405c1.768-.66,3.159-2.051,3.819-3.818l1.404,.524c-.812,2.175-2.524,3.888-4.698,4.699Z"
+ fill="currentColor"
+ />
+ <path
+ d="M15.091,6.727c-.658-1.767-2.05-3.159-3.818-3.819l.525-1.405c2.175,.812,3.888,2.525,4.699,4.7l-1.406,.524Z"
+ fill="currentColor"
+ />
+ <path
+ d="M2.908,6.727l-1.404-.524c.812-2.175,2.524-3.888,4.698-4.699l.525,1.405c-1.768,.66-3.159,2.051-3.819,3.818Z"
+ fill="currentColor"
+ />
+ <path
+ d="M10.312,6.237c-.087,0-.176-.015-.263-.047-.675-.251-1.429-.251-2.098,0-.188,.069-.394,.062-.574-.021-.181-.083-.321-.233-.392-.42l-1.399-3.749c-.069-.186-.062-.393,.021-.574,.083-.181,.234-.322,.42-.391,1.902-.71,4.045-.71,5.947,0,.388,.145,.585,.577,.44,.965l-1.399,3.75c-.113,.302-.399,.488-.703,.488Z"
+ fill="currentColor"
+ />
+ <path
+ d="M16.263,12.46c-.087,0-.176-.015-.263-.047l-3.749-1.399c-.388-.145-.585-.577-.44-.965,.126-.336,.189-.689,.189-1.049,0-.362-.063-.714-.188-1.047-.07-.187-.062-.393,.02-.575,.083-.181,.233-.322,.42-.392l3.749-1.399c.393-.145,.82,.053,.965,.44,.355,.949,.535,1.95,.535,2.973s-.18,2.024-.535,2.973c-.112,.301-.398,.487-.702,.487Z"
+ fill="currentColor"
+ />
+ <path
+ d="M9,17.5c-1.022,0-2.022-.18-2.974-.535-.388-.145-.585-.577-.44-.965l1.399-3.75c.146-.388,.576-.585,.966-.44,.675,.251,1.429,.251,2.098,0,.187-.07,.393-.063,.574,.021,.181,.083,.321,.233,.392,.42l1.399,3.749c.069,.186,.062,.393-.021,.574-.083,.181-.234,.322-.42,.391-.951,.355-1.951,.535-2.974,.535Z"
+ fill="currentColor"
+ />
+ <path
+ d="M1.737,12.46c-.304,0-.59-.186-.702-.487-.355-.949-.535-1.95-.535-2.973s.18-2.024,.535-2.973c.145-.387,.574-.584,.965-.44l3.749,1.399c.388,.145,.585,.577,.44,.965-.126,.336-.189,.689-.189,1.049,0,.362,.063,.714,.188,1.047,.07,.187,.062,.393-.02,.575-.083,.181-.233,.322-.42,.392l-3.749,1.399c-.087,.032-.176,.047-.263,.047Z"
+ fill="currentColor"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/nucleo/life-ring.tsx b/packages/ui/src/icons/nucleo/life-ring.tsx
index 5b2e9557f6..d120fd5845 100644
--- a/packages/ui/src/icons/nucleo/life-ring.tsx
+++ b/packages/ui/src/icons/nucleo/life-ring.tsx
@@ -11,52 +11,100 @@ export function LifeRing(props: SVGProps<SVGSVGElement>) {
>
<g fill="currentColor">
<path
- d="M6.188,7.951l-1.404-.525c.457-1.223,1.42-2.186,2.643-2.643l.525,1.405c-.815,.305-1.458,.947-1.764,1.763Z"
- fill="currentColor"
+ d="M5.486,7.688c.379-1.016,1.187-1.823,2.203-2.203"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
/>
<path
- d="M11.812,7.951c-.306-.815-.948-1.458-1.764-1.763l.525-1.405c1.223,.457,2.186,1.42,2.643,2.643l-1.404,.525Z"
- fill="currentColor"
+ d="M10.312,5.486c1.016,.379,1.823,1.187,2.203,2.203"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
/>
<path
- d="M10.574,13.217l-.525-1.405c.815-.305,1.458-.947,1.764-1.763l1.404,.525c-.457,1.223-1.42,2.186-2.643,2.643Z"
- fill="currentColor"
+ d="M12.514,10.312c-.379,1.016-1.187,1.823-2.203,2.203"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
/>
<path
- d="M7.426,13.217c-1.223-.457-2.186-1.42-2.643-2.643l1.404-.525c.306,.815,.948,1.458,1.764,1.763l-.525,1.405Z"
- fill="currentColor"
+ d="M7.688,12.514c-1.016-.379-1.823-1.187-2.203-2.203"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
/>
<path
- d="M6.202,16.497c-2.174-.812-3.887-2.524-4.698-4.699l1.404-.524c.66,1.767,2.052,3.159,3.819,3.818l-.525,1.405Z"
- fill="currentColor"
+ d="M6.464,15.794c-1.964-.733-3.525-2.294-4.259-4.259"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
/>
<path
- d="M11.798,16.497l-.525-1.405c1.768-.66,3.159-2.051,3.819-3.818l1.404,.524c-.812,2.175-2.524,3.888-4.698,4.699Z"
- fill="currentColor"
+ d="M15.794,11.536c-.733,1.964-2.295,3.525-4.259,4.259"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
/>
<path
- d="M15.091,6.727c-.658-1.767-2.05-3.159-3.818-3.819l.525-1.405c2.175,.812,3.888,2.525,4.699,4.7l-1.406,.524Z"
- fill="currentColor"
+ d="M11.536,2.206c1.964,.733,3.525,2.295,4.259,4.259"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
/>
<path
- d="M2.908,6.727l-1.404-.524c.812-2.175,2.524-3.888,4.698-4.699l.525,1.405c-1.768,.66-3.159,2.051-3.819,3.818Z"
- fill="currentColor"
+ d="M2.206,6.464c.733-1.964,2.294-3.525,4.259-4.259"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
/>
<path
- d="M10.312,6.237c-.087,0-.176-.015-.263-.047-.675-.251-1.429-.251-2.098,0-.188,.069-.394,.062-.574-.021-.181-.083-.321-.233-.392-.42l-1.399-3.749c-.069-.186-.062-.393,.021-.574,.083-.181,.234-.322,.42-.391,1.902-.71,4.045-.71,5.947,0,.388,.145,.585,.577,.44,.965l-1.399,3.75c-.113,.302-.399,.488-.703,.488Z"
- fill="currentColor"
+ d="M10.311,5.487l1.399-3.749h0c-.844-.315-1.757-.487-2.711-.487-.954,0-1.867,.172-2.711,.487l1.399,3.749c.409-.153,.849-.236,1.311-.236s.903,.084,1.311,.237Z"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
/>
<path
- d="M16.263,12.46c-.087,0-.176-.015-.263-.047l-3.749-1.399c-.388-.145-.585-.577-.44-.965,.126-.336,.189-.689,.189-1.049,0-.362-.063-.714-.188-1.047-.07-.187-.062-.393,.02-.575,.083-.181,.233-.322,.42-.392l3.749-1.399c.393-.145,.82,.053,.965,.44,.355,.949,.535,1.95,.535,2.973s-.18,2.024-.535,2.973c-.112,.301-.398,.487-.702,.487Z"
- fill="currentColor"
+ d="M12.513,10.311l3.749,1.399h0c.315-.844,.487-1.757,.487-2.71,0-.954-.172-1.867-.487-2.711l-3.749,1.399c.153,.409,.236,.849,.236,1.311s-.084,.903-.237,1.311Z"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
/>
<path
- d="M9,17.5c-1.022,0-2.022-.18-2.974-.535-.388-.145-.585-.577-.44-.965l1.399-3.75c.146-.388,.576-.585,.966-.44,.675,.251,1.429,.251,2.098,0,.187-.07,.393-.063,.574,.021,.181,.083,.321,.233,.392,.42l1.399,3.749c.069,.186,.062,.393-.021,.574-.083,.181-.234,.322-.42,.391-.951,.355-1.951,.535-2.974,.535Z"
- fill="currentColor"
+ d="M7.689,12.513l-1.399,3.749h0c.844,.315,1.757,.487,2.711,.487,.954,0,1.867-.172,2.711-.487l-1.399-3.749c-.409,.153-.849,.236-1.311,.236s-.903-.084-1.311-.237Z"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
/>
<path
- d="M1.737,12.46c-.304,0-.59-.186-.702-.487-.355-.949-.535-1.95-.535-2.973s.18-2.024,.535-2.973c.145-.387,.574-.584,.965-.44l3.749,1.399c.388,.145,.585,.577,.44,.965-.126,.336-.189,.689-.189,1.049,0,.362,.063,.714,.188,1.047,.07,.187,.062,.393-.02,.575-.083,.181-.233,.322-.42,.392l-3.749,1.399c-.087,.032-.176,.047-.263,.047Z"
- fill="currentColor"
+ d="M5.487,7.689l-3.749-1.399h0c-.315,.844-.487,1.757-.487,2.71,0,.954,.172,1.867,.487,2.711l3.749-1.399c-.153-.409-.236-.849-.236-1.311s.084-.903,.237-1.311Z"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
/>
</g>
</svg>
diff --git a/packages/ui/src/icons/nucleo/msgs-dotted.tsx b/packages/ui/src/icons/nucleo/msgs-dotted.tsx
index aed3f8dc4c..ae6d35be28 100644
--- a/packages/ui/src/icons/nucleo/msgs-dotted.tsx
+++ b/packages/ui/src/icons/nucleo/msgs-dotted.tsx
@@ -25,7 +25,8 @@ export function MsgsDotted(props: SVGProps<SVGSVGElement>) {
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
- strokeDasharray="1.5 3"
+ strokeDasharray="1.2 2.5"
+ strokeDashoffset="-0.2"
opacity="0.6"
/>
</g>
diff --git a/packages/ui/src/nav/content/resources-content.tsx b/packages/ui/src/nav/content/resources-content.tsx
index 12dba34ad9..00c5a78603 100644
--- a/packages/ui/src/nav/content/resources-content.tsx
+++ b/packages/ui/src/nav/content/resources-content.tsx
@@ -3,7 +3,7 @@ import { Link as NavigationMenuLink } from "@radix-ui/react-navigation-menu";
import Link from "next/link";
import { RESOURCES } from "../../content";
import { Grid } from "../../grid";
-import { Book2Fill, LifeRing } from "../../icons";
+import { Book2Fill, LifeRingFill } from "../../icons";
import {
ContentLinkCard,
contentHeadingClassName,
@@ -12,7 +12,7 @@ import {
const mainLinks = [
{
- icon: LifeRing,
+ icon: LifeRingFill,
title: "Help Center",
description: "Answers to your questions",
thumbnail: "https://assets.dub.co/misc/help-thumbnail.jpg", // TODO: Update