chore(admin): update dependencies and remove promo code functionality - #1298
Conversation
## Summary - Upgraded `next` to version 16.0.7 and `react` to version 19.2.1 across admin and UI applications. - Removed promo code handling from payment processing and UI components, simplifying the top-up credits dialog and related payment routes. ## Changes - Updated `package.json` files to reflect new dependency versions. - Deleted middleware handling for promo codes in the admin application. - Refactored payment routes to eliminate promo code logic. - Adjusted UI components to remove promo code input fields and related logic. ## Test Plan - [ ] Verify that the admin dashboard functions correctly with updated dependencies. - [ ] Ensure that payment processing works without promo code functionality. - [ ] Confirm that the top-up credits dialog displays correctly without promo code inputs.
WalkthroughRemoves promo-code support from backend and frontend payment flows, renames admin export Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (3)
🧰 Additional context used📓 Path-based instructions (6)**/*.{ts,tsx,js,jsx,json,md}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
apps/{ui,playground}/**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{js,ts,tsx,jsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
apps/{ui,playground,docs}/**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
🔇 Additional comments (7)
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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
apps/ui/src/components/credits/top-up-credits-dialog.tsx (2)
282-295: Remove dead code referencing removed promo fields.The API no longer returns
promoDiscountAmountortotalAmountBeforePromofields (as seen inapps/api/src/routes/payments.ts), but the UI still checks for them. These conditional blocks will never execute and should be removed.Apply this diff to clean up the dead code:
)} - {feeData.promoDiscountAmount && ( - <div className="flex justify-between"> - <span>Total before promo</span> - <span>${feeData.totalAmountBeforePromo.toFixed(2)}</span> - </div> - )} <div className="border-t pt-1 flex justify-between font-medium"> - <span> - {feeData.promoDiscountAmount - ? "Total after promo" - : "Total"} - </span> + <span>Total</span> <span>${feeData.totalAmount.toFixed(2)}</span> </div>
729-740: Remove dead code referencing removed promo fields.Similar to the AmountStep, this code references
promoDiscountAmountandtotalAmountBeforePromowhich are no longer returned by the API.Apply this diff:
)} - {feeData.promoDiscountAmount && ( - <div className="flex justify-between"> - <span>Total before promo</span> - <span>${feeData.totalAmountBeforePromo.toFixed(2)}</span> - </div> - )} <div className="border-t pt-2 flex justify-between font-medium"> - <span> - {feeData.promoDiscountAmount ? "Total after promo" : "Total"} - </span> + <span>Total</span> <span>${feeData.totalAmount.toFixed(2)}</span> </div>apps/playground/src/components/credits/top-up-credits-dialog.tsx (2)
261-279: Remove dead code and unsafe type casts.The code uses
(feeData as any)to accesspromoDiscountAmountandtotalAmountBeforePromo, which are no longer returned by the API. Theseas anycasts are masking the fact that these fields don't exist in the type, and the conditional blocks will never execute.Apply this diff:
)} - {(feeData as any).promoDiscountAmount && ( - <div className="flex justify-between"> - <span>Total before promo</span> - <span> - $ - {( - (feeData as any).totalAmountBeforePromo as number - ).toFixed(2)} - </span> - </div> - )} <div className="border-t pt-1 flex justify-between font-medium"> - <span> - {(feeData as any).promoDiscountAmount - ? "Total after promo" - : "Total"} - </span> + <span>Total</span> <span>${feeData.totalAmount.toFixed(2)}</span> </div>
666-684: Remove dead code and unsafe type casts.Same issue as in the AmountStep—these fields no longer exist in the API response.
Apply this diff:
)} - {(feeData as any).promoDiscountAmount && ( - <div className="flex justify-between"> - <span>Total before promo</span> - <span> - $ - {( - (feeData as any).totalAmountBeforePromo as number - ).toFixed(2)} - </span> - </div> - )} <div className="border-t pt-2 flex justify-between font-medium"> - <span> - {(feeData as any).promoDiscountAmount - ? "Total after promo" - : "Total"} - </span> + <span>Total</span> <span>${feeData.totalAmount.toFixed(2)}</span> </div>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
apps/admin/src/lib/api/v1.d.tsis excluded by!**/v1.d.tspnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (9)
apps/admin/package.json(1 hunks)apps/admin/proxy.ts(1 hunks)apps/api/src/routes/payments.ts(6 hunks)apps/api/src/stripe.ts(0 hunks)apps/playground/src/components/credits/top-up-credits-dialog.tsx(4 hunks)apps/ui/package.json(1 hunks)apps/ui/src/components/credits/top-up-credits-dialog.tsx(4 hunks)apps/ui/src/components/dashboard/dashboard-client.tsx(2 hunks)apps/ui/src/components/dashboard/metric-card.tsx(1 hunks)
💤 Files with no reviewable changes (1)
- apps/api/src/stripe.ts
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Never useanyoras anyunless absolutely necessary in TypeScript code
For database reads: Usedb().query.<table>.findMany()ordb().query.<table>.findFirst()
Files:
apps/admin/proxy.tsapps/ui/src/components/credits/top-up-credits-dialog.tsxapps/ui/src/components/dashboard/metric-card.tsxapps/ui/src/components/dashboard/dashboard-client.tsxapps/playground/src/components/credits/top-up-credits-dialog.tsxapps/api/src/routes/payments.ts
**/*.{ts,tsx,js,jsx,json,md}
📄 CodeRabbit inference engine (CLAUDE.md)
Always use tabs for indentation
Files:
apps/admin/proxy.tsapps/ui/src/components/credits/top-up-credits-dialog.tsxapps/ui/package.jsonapps/ui/src/components/dashboard/metric-card.tsxapps/admin/package.jsonapps/ui/src/components/dashboard/dashboard-client.tsxapps/playground/src/components/credits/top-up-credits-dialog.tsxapps/api/src/routes/payments.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,js,jsx}: Always use top-levelimport, never use require or dynamic imports
No unnecessary code comments
Files:
apps/admin/proxy.tsapps/ui/src/components/credits/top-up-credits-dialog.tsxapps/ui/src/components/dashboard/metric-card.tsxapps/ui/src/components/dashboard/dashboard-client.tsxapps/playground/src/components/credits/top-up-credits-dialog.tsxapps/api/src/routes/payments.ts
**/*.{js,ts,tsx,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Always use top-level
import, never use require or dynamic imports
Files:
apps/admin/proxy.tsapps/ui/src/components/credits/top-up-credits-dialog.tsxapps/ui/src/components/dashboard/metric-card.tsxapps/ui/src/components/dashboard/dashboard-client.tsxapps/playground/src/components/credits/top-up-credits-dialog.tsxapps/api/src/routes/payments.ts
apps/{ui,playground}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
apps/{ui,playground}/**/*.{ts,tsx}: Use cookies for user-settings which are not saved in the database to ensure SSR works
Use Next.js App Router with React Server Components for frontend developmentUse cookies for user-settings which are not saved in the database to ensure SSR works
Files:
apps/ui/src/components/credits/top-up-credits-dialog.tsxapps/ui/src/components/dashboard/metric-card.tsxapps/ui/src/components/dashboard/dashboard-client.tsxapps/playground/src/components/credits/top-up-credits-dialog.tsx
apps/{ui,playground,docs}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use
next/linkfor links andnext/navigation's router for programmatic navigation
Files:
apps/ui/src/components/credits/top-up-credits-dialog.tsxapps/ui/src/components/dashboard/metric-card.tsxapps/ui/src/components/dashboard/dashboard-client.tsxapps/playground/src/components/credits/top-up-credits-dialog.tsx
apps/{gateway,api}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Use Hono framework with Zod validation and OpenAPI documentation for backend APIs
Files:
apps/api/src/routes/payments.ts
{apps/api,apps/gateway,packages/db}/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
{apps/api,apps/gateway,packages/db}/**/*.ts: Use Drizzle ORM with latest object syntax for database operations
For database reads: Usedb().query.<table>.findMany()ordb().query.<table>.findFirst()
Files:
apps/api/src/routes/payments.ts
apps/{gateway,api}/src/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
apps/{gateway,api}/src/**/*.ts: Use Hono for backend framework in Gateway and API services
Use Zod schemas for validation in Hono services
Files:
apps/api/src/routes/payments.ts
🧠 Learnings (3)
📚 Learning: 2025-12-03T12:42:26.143Z
Learnt from: CR
Repo: theopenco/llmgateway PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-03T12:42:26.143Z
Learning: Applies to apps/{ui,playground,docs}/**/*.{ts,tsx} : Use `next/link` for links and `next/navigation`'s router for programmatic navigation
Applied to files:
apps/ui/package.jsonapps/admin/package.json
📚 Learning: 2025-12-03T12:42:14.208Z
Learnt from: CR
Repo: theopenco/llmgateway PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-03T12:42:14.208Z
Learning: Applies to apps/{ui,playground}/**/*.{ts,tsx} : Use Next.js App Router with React Server Components for frontend development
Applied to files:
apps/ui/package.jsonapps/admin/package.json
📚 Learning: 2025-09-22T18:29:26.406Z
Learnt from: smakosh
Repo: theopenco/llmgateway PR: 911
File: apps/ui/src/lib/components/tweet-card.tsx:244-255
Timestamp: 2025-09-22T18:29:26.406Z
Learning: In the tweet-card component at apps/ui/src/lib/components/tweet-card.tsx, the TweetMedia component is intentionally not used in the MagicTweet component. This is a deliberate design decision to keep testimonials text-focused without rendering images or videos from tweets.
Applied to files:
apps/ui/src/components/dashboard/metric-card.tsx
🧬 Code graph analysis (3)
apps/ui/src/components/dashboard/metric-card.tsx (1)
apps/docs/lib/source.ts (1)
icon(14-28)
apps/ui/src/components/dashboard/dashboard-client.tsx (1)
apps/ui/src/components/dashboard/metric-card.tsx (1)
MetricCard(3-46)
apps/api/src/routes/payments.ts (1)
packages/shared/src/fees.ts (1)
calculateFees(21-50)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
- GitHub Check: build-split (admin, linux/amd64)
- GitHub Check: build-split (ui, linux/amd64)
- GitHub Check: build-split (playground, linux/amd64)
- GitHub Check: build-split (worker, linux/amd64)
- GitHub Check: build-split (gateway, linux/amd64)
- GitHub Check: build-split (docs, linux/amd64)
- GitHub Check: build-split (api, linux/amd64)
- GitHub Check: build-unified (linux/amd64)
- GitHub Check: test / run
- GitHub Check: build / run
- GitHub Check: generate / run
- GitHub Check: lint / run
- GitHub Check: autofix
🔇 Additional comments (6)
apps/api/src/routes/payments.ts (3)
58-101: LGTM! Promo code removal is clean.The promo code logic has been properly removed from the payment intent creation flow. The code now only handles the base amount, calculates fees correctly, and includes appropriate metadata without promo-related fields.
437-528: LGTM! Promo code removal is consistent.The top-up flow correctly removes all promo code handling while preserving the necessary fee calculation with card country detection for international fees.
568-673: LGTM! Fee calculation properly excludes promo codes.The calculate-fees endpoint has been correctly updated to:
- Remove promo code from request schema
- Exclude promo-related fields from response schema
- Preserve bonus logic (which is separate from promo codes)
The bonus logic for first-time credit purchases remains intact and is working as intended.
apps/ui/src/components/dashboard/dashboard-client.tsx (1)
246-316: Verify the grid layout change from 5 to 3 columns.The refactor to use
MetricCardcomponents looks clean, but the grid layout has changed fromlg:grid-cols-5tolg:grid-cols-3. With 5 metric cards, this will create a 3-2 layout (3 cards in the first row, 2 in the second row).Was this layout change intentional? The previous 5-column layout would have displayed all metrics in a single row on large screens.
If the 3-column layout is intentional and provides better responsive behavior, this refactor successfully consolidates the metric card rendering into a reusable component while maintaining all the data aggregation and conditional logic.
apps/ui/src/components/dashboard/metric-card.tsx (1)
1-46: LGTM! Well-structured reusable component.The
MetricCardcomponent is well-designed with:
- Clear prop interface with appropriate types
- Proper use of conditional rendering for optional elements
- Consistent styling using Tailwind with accent color variants
- Good use of
cnutility for dynamic class compositionThe component successfully consolidates metric card rendering logic and is properly consumed by
dashboard-client.tsx.apps/admin/proxy.ts (1)
13-13: This review comment is incorrect; the function rename does not affect Next.js middleware.The
proxy.tsfile is not configured as Next.js middleware. Thenext.config.tsdoes not specify any middleware configuration, and there are no imports of thisproxyfunction anywhere in the codebase. The function appears to be either unused code or will be imported later. The rename frommiddlewaretoproxyhas no functional impact.Likely an incorrect or invalid review comment.
Summary
nextto version 16.0.7 andreactto version 19.2.1 across admin and UI applications.Changes
package.jsonfiles to reflect new dependency versions.Test Plan
Summary by CodeRabbit
New Features
Changes
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.