The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Renaming
Tim Wilson041fa3ebd70a
diff --git a/apps/web/app/(ee)/api/partners/[partnerId]/comments/route.ts b/apps/web/app/(ee)/api/partners/[partnerId]/comments/route.tsindex 03cbf65e9f..7efa2be07d 100644--- a/apps/web/app/(ee)/api/partners/[partnerId]/comments/route.ts+++ b/apps/web/app/(ee)/api/partners/[partnerId]/comments/route.ts@@ -1,6 +1,6 @@import { getDefaultProgramIdOrThrow } from "@/lib/api/programs/get-default-program-id-or-throw";import { withWorkspace } from "@/lib/auth";-import { ProgramPartnerCommentSchema } from "@/lib/zod/schemas/programs";+import { PartnerCommentSchema } from "@/lib/zod/schemas/programs";import { prisma } from "@dub/prisma";import { NextResponse } from "next/server";import { z } from "zod";@@ -24,9 +24,7 @@ export const GET = withWorkspace(},});- return NextResponse.json(- z.array(ProgramPartnerCommentSchema).parse(comments),- );+ return NextResponse.json(z.array(PartnerCommentSchema).parse(comments));},{requiredPlan: [diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/[partnerId]/comments/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/[partnerId]/comments/page-client.tsxindex 9fc988b384..2e73c3ce96 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/[partnerId]/comments/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/[partnerId]/comments/page-client.tsx@@ -6,7 +6,7 @@ import { mutatePrefix } from "@/lib/swr/mutate";import { usePartnerComments } from "@/lib/swr/use-partner-comments";import useUser from "@/lib/swr/use-user";import useWorkspace from "@/lib/swr/use-workspace";-import { ProgramPartnerCommentProps } from "@/lib/types";+import { PartnerCommentProps } from "@/lib/types";import { ThreeDots } from "@/ui/shared/icons";import { MessageInput } from "@/ui/shared/message-input";import { Button, LoadingSpinner, Popover, Trash } from "@dub/ui";@@ -38,7 +38,7 @@ export function ProgramPartnerCommentsPageClient() {const createdAt = new Date();- const optimisticComment: ProgramPartnerCommentProps & {+ const optimisticComment: PartnerCommentProps & {delivered?: false;} = {id: `tmp_${uuid()}`,@@ -118,7 +118,7 @@ function CommentCard({comment,className,}: {- comment?: ProgramPartnerCommentProps & { delivered?: false };+ comment?: PartnerCommentProps & { delivered?: false };className?: string;}) {const { partnerId } = useParams() as { partnerId: string };diff --git a/apps/web/lib/actions/partners/create-partner-comment.ts b/apps/web/lib/actions/partners/create-partner-comment.tsindex 838fcfdfd2..7e82e8560b 100644--- a/apps/web/lib/actions/partners/create-partner-comment.ts+++ b/apps/web/lib/actions/partners/create-partner-comment.ts@@ -4,14 +4,14 @@ import { getDefaultProgramIdOrThrow } from "@/lib/api/programs/get-default-progrimport { getProgramEnrollmentOrThrow } from "@/lib/api/programs/get-program-enrollment-or-throw";import { prisma } from "@dub/prisma";import {- ProgramPartnerCommentSchema,- createProgramPartnerCommentSchema,+ PartnerCommentSchema,+ createPartnerCommentSchema,} from "../../zod/schemas/programs";import { authActionClient } from "../safe-action";// Create a partner commentexport const createPartnerCommentAction = authActionClient- .schema(createProgramPartnerCommentSchema)+ .schema(createPartnerCommentSchema).action(async ({ parsedInput, ctx }) => {const { workspace, user } = ctx;const { partnerId, text, createdAt } = parsedInput;@@ -37,6 +37,6 @@ export const createPartnerCommentAction = authActionClient});return {- comment: ProgramPartnerCommentSchema.parse(comment),+ comment: PartnerCommentSchema.parse(comment),};});diff --git a/apps/web/lib/actions/partners/delete-partner-comment.ts b/apps/web/lib/actions/partners/delete-partner-comment.tsindex 0453d02df7..1cb983201e 100644--- a/apps/web/lib/actions/partners/delete-partner-comment.ts+++ b/apps/web/lib/actions/partners/delete-partner-comment.ts@@ -2,12 +2,12 @@import { getDefaultProgramIdOrThrow } from "@/lib/api/programs/get-default-program-id-or-throw";import { prisma } from "@dub/prisma";-import { deleteProgramPartnerCommentSchema } from "../../zod/schemas/programs";+import { deletePartnerCommentSchema } from "../../zod/schemas/programs";import { authActionClient } from "../safe-action";// Delete a partner commentexport const deletePartnerCommentAction = authActionClient- .schema(deleteProgramPartnerCommentSchema)+ .schema(deletePartnerCommentSchema).action(async ({ parsedInput, ctx }) => {const { workspace } = ctx;const { commentId } = parsedInput;diff --git a/apps/web/lib/swr/use-partner-comments.ts b/apps/web/lib/swr/use-partner-comments.tsindex 5ff5404eea..79aaf41ea7 100644--- a/apps/web/lib/swr/use-partner-comments.ts+++ b/apps/web/lib/swr/use-partner-comments.ts@@ -1,6 +1,6 @@import { fetcher } from "@dub/utils";import useSWR, { SWRConfiguration } from "swr";-import { ProgramPartnerCommentProps } from "../types";+import { PartnerCommentProps } from "../types";import useWorkspace from "./use-workspace";export function usePartnerComments(@@ -14,7 +14,7 @@ export function usePartnerComments(const { id: workspaceId } = useWorkspace();const { data, isLoading, error, mutate } = useSWR<- (ProgramPartnerCommentProps & { delivered?: false })[]+ (PartnerCommentProps & { delivered?: false })[]>(workspaceId? `/api/partners/${partnerId}/comments?${new URLSearchParams({diff --git a/apps/web/lib/types.ts b/apps/web/lib/types.tsindex 2fa5a126c7..97bc8162d1 100644--- a/apps/web/lib/types.ts+++ b/apps/web/lib/types.ts@@ -79,11 +79,11 @@ import {import { programLanderSchema } from "./zod/schemas/program-lander";import { programDataSchema } from "./zod/schemas/program-onboarding";import {+ PartnerCommentSchema,PartnerProgramInviteSchema,ProgramEnrollmentSchema,ProgramInviteSchema,ProgramMetricsSchema,- ProgramPartnerCommentSchema,ProgramPartnerLinkSchema,ProgramSchema,ProgramWithLanderDataSchema,@@ -555,9 +555,7 @@ export type PartnerGroupProps = PartnerGroup & {additionalLinks: PartnerGroupAdditionalLink[];};-export type ProgramPartnerCommentProps = z.infer<- typeof ProgramPartnerCommentSchema->;+export type PartnerCommentProps = z.infer<typeof PartnerCommentSchema>;export type BountyProps = z.infer<typeof BountySchema>;export type BountyListProps = z.infer<typeof BountyListSchema>;diff --git a/apps/web/lib/zod/schemas/programs.ts b/apps/web/lib/zod/schemas/programs.tsindex a4e907cd78..5284392ceb 100644--- a/apps/web/lib/zod/schemas/programs.ts+++ b/apps/web/lib/zod/schemas/programs.ts@@ -175,7 +175,7 @@ export const createProgramApplicationSchema = z.object({comments: z.string().trim().max(5000).optional(),});-export const ProgramPartnerCommentSchema = z.object({+export const PartnerCommentSchema = z.object({id: z.string(),programId: z.string(),partnerId: z.string(),@@ -192,7 +192,7 @@ export const ProgramPartnerCommentSchema = z.object({export const MAX_PROGRAM_PARTNER_COMMENT_LENGTH = 2000;-export const createProgramPartnerCommentSchema = z.object({+export const createPartnerCommentSchema = z.object({workspaceId: z.string(),partnerId: z.string(),text: z.string().min(1).max(MAX_PROGRAM_PARTNER_COMMENT_LENGTH),@@ -208,7 +208,23 @@ export const createProgramPartnerCommentSchema = z.object({),});-export const deleteProgramPartnerCommentSchema = z.object({+export const updatePartnerCommentSchema = z.object({+ workspaceId: z.string(),+ partnerId: z.string(),+ text: z.string().min(1).max(MAX_PROGRAM_PARTNER_COMMENT_LENGTH),+ createdAt: z.coerce+ .date()+ .refine(+ (date) =>+ date.getTime() <= Date.now() &&+ date.getTime() >= Date.now() - 1000 * 60,+ {+ message: "Comment timestamp must be within the last 60 seconds",+ },+ ),+});++export const deletePartnerCommentSchema = z.object({workspaceId: z.string(),commentId: z.string(),});