refactor: simplify checkout URL handling and update Dodo mode configuration: - #253
Conversation
…ration: - Removed hardcoded product checkout URLs and streamlined the URL generation in the getCheckoutUrl function. - Updated the DODO_MODE environment variable in the .env.example file to default to an empty string for clarity.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
WalkthroughThe Studio checkout flow now derives URLs from plan product IDs and opens payment links in a new tab. The server environment example leaves ChangesCheckout configuration
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/supercode-cli/client/app/studio/page.tsx`:
- Line 298: Update the payment-link flow around window.open to clear
confirmingPlan immediately after the new tab is opened, ensuring the checkout
dialog closes and duplicate Pay now attempts cannot be initiated.
In `@apps/supercode-cli/server/.env.example`:
- Line 88: Update the DODO_MODE example configuration to use "test" as the safe
default, matching the test-mode check in the seed logic. Keep the existing
consumer behavior unchanged and ensure copied example configurations cannot
select the live payment branch by default.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 32965e1b-c075-4e27-b0b1-97a446c5e362
📒 Files selected for processing (2)
apps/supercode-cli/client/app/studio/page.tsxapps/supercode-cli/server/.env.example
| const url = getCheckoutUrl(confirmingPlan) | ||
| if (url) { | ||
| window.location.href = url | ||
| window.open(url, "_blank", "noopener,noreferrer") |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Close the checkout dialog after opening the payment link.
The new-tab path leaves confirmingPlan set. The dialog remains open in the current tab, so the user can click Pay now again and start multiple checkout attempts. Clear the state after window.open returns.
Proposed fix
window.open(url, "_blank", "noopener,noreferrer")
+ setConfirmingPlan(null)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| window.open(url, "_blank", "noopener,noreferrer") | |
| window.open(url, "_blank", "noopener,noreferrer") | |
| setConfirmingPlan(null) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/supercode-cli/client/app/studio/page.tsx` at line 298, Update the
payment-link flow around window.open to clear confirmingPlan immediately after
the new tab is opened, ensuring the checkout dialog closes and duplicate Pay now
attempts cannot be initiated.
| DODO_PAYMENTS_WEBHOOK_KEY="" | ||
| # ⚪ "test" to use test-mode product IDs in the seed; omit for live. | ||
| DODO_MODE="test" | ||
| DODO_MODE="" |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Keep the example in test mode or make live mode explicit.
apps/supercode-cli/server/prisma/seed.ts:13 treats only "test" as test mode. With DODO_MODE="", a copied example configuration selects the non-test payment branch until an operator changes it. Keep "test" as the safe default, or update the consumer to require an explicit live-mode value.
🧰 Tools
🪛 dotenv-linter (4.0.0)
[warning] 88-88: [QuoteCharacter] The value has quote characters (', ")
(QuoteCharacter)
[warning] 88-88: [UnorderedKey] The DODO_MODE key should go before the DODO_PAYMENTS_API_KEY key
(UnorderedKey)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/supercode-cli/server/.env.example` at line 88, Update the DODO_MODE
example configuration to use "test" as the safe default, matching the test-mode
check in the seed logic. Keep the existing consumer behavior unchanged and
ensure copied example configurations cannot select the live payment branch by
default.
Description
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
bun testpassesbun run typecheckpassesbun run lintpasses (if applicable)Checklist:
Summary by CodeRabbit