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.

update sales limits

Steven Tey5a6d11641bf7
diff --git a/apps/web/app/api/stripe/webhook/checkout-session-completed.ts b/apps/web/app/api/stripe/webhook/checkout-session-completed.ts
index b6b565c079..3abea4dc14 100644
--- a/apps/web/app/api/stripe/webhook/checkout-session-completed.ts
+++ b/apps/web/app/api/stripe/webhook/checkout-session-completed.ts
@@ -67,6 +67,7 @@ export async function checkoutSessionCompleted(event: Stripe.Event) {
aiLimit: plan.limits.ai!,
tagsLimit: plan.limits.tags!,
usersLimit: plan.limits.users!,
+ salesLimit: plan.limits.sales!,
},
select: {
users: {
diff --git a/apps/web/app/api/stripe/webhook/customer-subscription-deleted.ts b/apps/web/app/api/stripe/webhook/customer-subscription-deleted.ts
index 6e53b1456c..b406cee6c2 100644
--- a/apps/web/app/api/stripe/webhook/customer-subscription-deleted.ts
+++ b/apps/web/app/api/stripe/webhook/customer-subscription-deleted.ts
@@ -92,6 +92,7 @@ export async function customerSubscriptionDeleted(event: Stripe.Event) {
aiLimit: FREE_PLAN.limits.ai!,
tagsLimit: FREE_PLAN.limits.tags!,
usersLimit: FREE_PLAN.limits.users!,
+ salesLimit: FREE_PLAN.limits.sales!,
paymentFailedAt: null,
},
}),
diff --git a/apps/web/app/api/stripe/webhook/customer-subscription-updated.ts b/apps/web/app/api/stripe/webhook/customer-subscription-updated.ts
index 77c9238981..7795ee3c05 100644
--- a/apps/web/app/api/stripe/webhook/customer-subscription-updated.ts
+++ b/apps/web/app/api/stripe/webhook/customer-subscription-updated.ts
@@ -77,6 +77,7 @@ export async function customerSubscriptionUpdated(event: Stripe.Event) {
aiLimit: plan.limits.ai!,
tagsLimit: plan.limits.tags!,
usersLimit: plan.limits.users!,
+ salesLimit: plan.limits.sales!,
paymentFailedAt: null,
},
}),
diff --git a/apps/web/scripts/update-sales-limits.ts b/apps/web/scripts/update-sales-limits.ts
new file mode 100644
index 0000000000..33b2b99204
--- /dev/null
+++ b/apps/web/scripts/update-sales-limits.ts
@@ -0,0 +1,18 @@
+import { prisma } from "@dub/prisma";
+import "dotenv-flow/config";
+
+async function main() {
+ const workspaces = await prisma.project.updateMany({
+ where: {
+ plan: "business",
+ salesLimit: 0,
+ },
+ data: {
+ salesLimit: 5000_00,
+ },
+ });
+
+ console.table(workspaces);
+}
+
+main();
diff --git a/packages/utils/src/constants/pricing.tsx b/packages/utils/src/constants/pricing.tsx
index 1089aec304..2ad8cee20d 100644
--- a/packages/utils/src/constants/pricing.tsx
+++ b/packages/utils/src/constants/pricing.tsx
@@ -126,6 +126,7 @@ export const PLANS = [
limits: {
links: 25,
clicks: 1000,
+ sales: 0,
domains: 3,
tags: 5,
users: 1,
@@ -194,6 +195,7 @@ export const PLANS = [
limits: {
links: 1000,
clicks: 50000,
+ sales: 0,
domains: 10,
tags: 25,
users: 5,
@@ -333,6 +335,7 @@ export const PLANS = [
limits: {
links: 250000,
clicks: 5000000,
+ sales: 1000000_00,
domains: 1000,
tags: 1000,
users: 500,