The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Rename WorkspaceEnvironment live to production
Kiran K0a3d75f3b147
diff --git a/apps/web/app/(ee)/api/cron/payouts/process/route.ts b/apps/web/app/(ee)/api/cron/payouts/process/route.tsindex ba07e6d283..786ae9ff3d 100644--- a/apps/web/app/(ee)/api/cron/payouts/process/route.ts+++ b/apps/web/app/(ee)/api/cron/payouts/process/route.ts@@ -3,6 +3,7 @@ import { verifyQstashSignature } from "@/lib/cron/verify-qstash";import { CUTOFF_PERIOD_ENUM } from "@/lib/partners/cutoff-period";import { mockSandboxPayoutCompletion } from "@/lib/sandbox/sandbox-payout";import { prisma } from "@dub/prisma";+import { WorkspaceEnvironment } from "@dub/prisma/client";import { log } from "@dub/utils";import * as z from "zod/v4";import { logAndRespond } from "../../utils";@@ -90,7 +91,7 @@ export async function POST(req: Request) {});}- if (workspace.environment === "live") {+ if (workspace.environment === WorkspaceEnvironment.production) {await processPayouts({program,workspace,diff --git a/apps/web/app/api/user/route.ts b/apps/web/app/api/user/route.tsindex 5e53120b50..cc3afc18a4 100644--- a/apps/web/app/api/user/route.ts+++ b/apps/web/app/api/user/route.ts@@ -100,10 +100,10 @@ export const PATCH = withSession(async ({ req, session }) => {});}- if (workspaceUser.project.environment !== WorkspaceEnvironment.live) {+ if (workspaceUser.project.environment !== WorkspaceEnvironment.production) {throw new DubApiError({code: "bad_request",- message: `You can only set your default workspace to a live workspace.`,+ message: `You can only set your default workspace to a production workspace.`,});}}diff --git a/apps/web/app/api/workspaces/[idOrSlug]/billing/payment-methods/route.ts b/apps/web/app/api/workspaces/[idOrSlug]/billing/payment-methods/route.tsindex 3ea6c00e9a..707b07881d 100644--- a/apps/web/app/api/workspaces/[idOrSlug]/billing/payment-methods/route.ts+++ b/apps/web/app/api/workspaces/[idOrSlug]/billing/payment-methods/route.ts@@ -7,6 +7,7 @@ import {PAYMENT_METHOD_TYPES,} from "@/lib/constants/payouts";import { stripe } from "@/lib/stripe";+import { WorkspaceEnvironment } from "@dub/prisma/client";import { APP_DOMAIN } from "@dub/utils";import { NextResponse } from "next/server";import Stripe from "stripe";@@ -20,7 +21,7 @@ const addPaymentMethodSchema = z.object({export const GET = withWorkspace(async ({ workspace }) => {// send a demo value- if (workspace.environment !== "live") {+ if (workspace.environment !== WorkspaceEnvironment.production) {return NextResponse.json([{id: "pm_sandbox_card",diff --git a/apps/web/app/api/workspaces/[idOrSlug]/users/route.ts b/apps/web/app/api/workspaces/[idOrSlug]/users/route.tsindex 528ae10f51..290b8c3382 100644--- a/apps/web/app/api/workspaces/[idOrSlug]/users/route.ts+++ b/apps/web/app/api/workspaces/[idOrSlug]/users/route.ts@@ -163,7 +163,7 @@ export const DELETE = withWorkspace(throw new DubApiError({code: "forbidden",message:- "This action is not available in a staging workspace. Use the live workspace instead.",+ "This action is not available in a staging workspace. Use the production workspace instead.",});}diff --git a/apps/web/lib/actions/partners/confirm-payouts.ts b/apps/web/lib/actions/partners/confirm-payouts.tsindex 40ac6413f5..08e632452e 100644--- a/apps/web/lib/actions/partners/confirm-payouts.ts+++ b/apps/web/lib/actions/partners/confirm-payouts.ts@@ -20,7 +20,7 @@ import { stripe } from "@/lib/stripe";import { checkPaymentMethodMandate } from "@/lib/stripe/check-payment-method-mandate";import { getWebhooks } from "@/lib/webhook/get-webhooks";import { prisma } from "@dub/prisma";-import { PaymentMethod } from "@dub/prisma/client";+import { PaymentMethod, WorkspaceEnvironment } from "@dub/prisma/client";import { APP_DOMAIN_WITH_NGROK } from "@dub/utils";import * as z from "zod/v4";import { authActionClient } from "../safe-action";@@ -150,7 +150,7 @@ export const confirmPayoutsAction = authActionClientlet paymentMethod: PaymentMethod | null = null;- if (workspace.environment === "live") {+ if (workspace.environment === WorkspaceEnvironment.production) {if (!workspace.stripeId) {throw new Error("Workspace does not have a valid Stripe ID.");}diff --git a/apps/web/lib/sandbox/copy-discount-to-live.ts b/apps/web/lib/sandbox/copy-discount-to-live.tsindex 1ac39f2824..6178151d41 100644--- a/apps/web/lib/sandbox/copy-discount-to-live.ts+++ b/apps/web/lib/sandbox/copy-discount-to-live.ts@@ -75,7 +75,7 @@ export const copyDiscountToLiveAction = authActionClientrequiredRoles: ["owner", "member"],});- if (targetWorkspace.environment !== WorkspaceEnvironment.live) {+ if (targetWorkspace.environment !== WorkspaceEnvironment.production) {throw new Error("Reward can only be copied to a live program.");}diff --git a/apps/web/lib/sandbox/copy-reward-to-live.ts b/apps/web/lib/sandbox/copy-reward-to-live.tsindex c4db40187d..59b9fc9d00 100644--- a/apps/web/lib/sandbox/copy-reward-to-live.ts+++ b/apps/web/lib/sandbox/copy-reward-to-live.ts@@ -70,7 +70,7 @@ export const copyRewardToLiveAction = authActionClientrequiredRoles: ["owner", "member"],});- if (targetWorkspace.environment !== WorkspaceEnvironment.live) {+ if (targetWorkspace.environment !== WorkspaceEnvironment.production) {throw new Error("Reward can only be copied to a live program.");}diff --git a/apps/web/ui/account/update-default-workspace.tsx b/apps/web/ui/account/update-default-workspace.tsxindex 6a40a040c3..7b2338ccac 100644--- a/apps/web/ui/account/update-default-workspace.tsx+++ b/apps/web/ui/account/update-default-workspace.tsx@@ -64,7 +64,7 @@ export default function UpdateDefaultWorkspace() {<WorkspaceSelectorselectedWorkspace={selectedWorkspace || ""}setSelectedWorkspace={setSelectedWorkspace}- environments={[WorkspaceEnvironment.live]}+ environments={[WorkspaceEnvironment.production]}showAddWorkspaceButton={false}/></div>diff --git a/apps/web/ui/layout/sidebar/workspace-environment-switcher.tsx b/apps/web/ui/layout/sidebar/workspace-environment-switcher.tsxindex 15a5a39738..af9fe1bdd9 100644--- a/apps/web/ui/layout/sidebar/workspace-environment-switcher.tsx+++ b/apps/web/ui/layout/sidebar/workspace-environment-switcher.tsx@@ -41,7 +41,7 @@ export function WorkspaceEnvironmentSwitcher({// Switch to stagingelse if (- currentWorkspace.environment === WorkspaceEnvironment.live &&+ currentWorkspace.environment === WorkspaceEnvironment.production &¤tWorkspace.stagingWorkspaceId) {targetWorkspace = workspaces.find(diff --git a/packages/prisma/schema/workspace.prisma b/packages/prisma/schema/workspace.prismaindex 18f0cb568b..d32298c6d1 100644--- a/packages/prisma/schema/workspace.prisma+++ b/packages/prisma/schema/workspace.prisma@@ -6,7 +6,7 @@ enum PlanPeriod {}enum WorkspaceEnvironment {- live+ productionstagingsandbox}@@ -30,7 +30,7 @@ model Project {paymentFailedAt DateTime?invoicePrefix String? @unique // prefix used to generate unique invoice numbers (for Dub Payouts)- environment WorkspaceEnvironment @default(live)+ environment WorkspaceEnvironment @default(production)stagingWorkspaceId String? @uniquestripeConnectId String? @unique // for Stripe Integration