The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Guard sandbox payout completion and shorten mock charge delay
Kiran K8e8920d5df25
diff --git a/apps/web/app/(ee)/api/cron/payouts/process/process-payouts.ts b/apps/web/app/(ee)/api/cron/payouts/process/process-payouts.tsindex f834049d17..54997f032a 100644--- a/apps/web/app/(ee)/api/cron/payouts/process/process-payouts.ts+++ b/apps/web/app/(ee)/api/cron/payouts/process/process-payouts.ts@@ -308,13 +308,13 @@ export async function processPayouts({}// Non-production workspaces skip the Stripe payment intent above.- // Simulate that flow here with a 2-minute delay so+ // Simulate that flow here with a 1-minute delay so// sandbox payouts behave like a settled ACH charge.if (!isProductionWorkspace) {await qstash.publishJSON({url: `${APP_DOMAIN_WITH_NGROK}/api/cron/payouts/charge-succeeded`,method: "POST",- delay: 2 * 60,+ delay: 1 * 60,flowControl: {key: invoice.id,rate: 1,diff --git a/apps/web/lib/hooks/use-dashboard-banner-visible.ts b/apps/web/lib/hooks/use-dashboard-banner-visible.tsindex e6096e07af..f143be3646 100644--- a/apps/web/lib/hooks/use-dashboard-banner-visible.ts+++ b/apps/web/lib/hooks/use-dashboard-banner-visible.ts@@ -15,11 +15,12 @@ export function useDashboardBannerVisible() {const isProductionWorkspace = environment === WorkspaceEnvironment.production;- // Only visible in production workspaces+ // Visible in production workspacesconst isUpgradeBannerVisible =(exceededEvents || exceededLinks || exceededPayouts || !!paymentFailedAt) &&isProductionWorkspace;+ // Visible in non-production workspacesconst isEnvironmentBannerVisible = !isProductionWorkspace;const hasBanner =diff --git a/apps/web/lib/sandbox/mock-payout-completion.ts b/apps/web/lib/sandbox/mock-payout-completion.tsindex 8956367e27..44d8b7e6d8 100644--- a/apps/web/lib/sandbox/mock-payout-completion.ts+++ b/apps/web/lib/sandbox/mock-payout-completion.ts@@ -55,6 +55,15 @@ export async function mockPayoutCompletion({return;}+ const program = payouts[0].program;++ if (program.workspace.environment === WorkspaceEnvironment.production) {+ console.error(+ `Skipping the payout completion for production workspace ${program.workspaceId}.`,+ );+ return;+ }+const payoutIds = payouts.map((p) => p.id);const commissions = await prisma.commission.findMany({