offer and item pages, edits, deletes#856
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Greptile Summary
This PR implements a comprehensive payments UI system for managing payment offers and items in the Stack Auth dashboard. The changes introduce dedicated pages for offers and items management, complete CRUD operations, and several UI enhancements.
Core functionality added:
- New payment management pages: Created separate pages for managing payment items (
/payments/items) and offers (/payments/offers), both gated behind dev feature flags - CRUD operations: Added full create, read, update, and delete functionality for both items and offers through modal dialogs with form validation
- Navigation integration: Added "Offers" and "Items" navigation links to the sidebar with appropriate icons (SquarePen and Box)
Key components introduced:
DialogOpener: A reusable component using render props to manage dialog state across the payments UIItemDialog: Form dialog for creating/editing payment items with validation and duplicate ID preventionOfferDialog: Comprehensive form dialog for managing payment offers with pricing, included items, and advanced options- Enhanced data tables with inline edit/delete actions and dependency validation (prevents deleting items used in offers)
Schema and validation improvements:
- Made
quantityfield required for included items in offers (changed from optional to.defined()) - Updated default quantity value from
undefinedto0to prevent calculation errors - Added support for "unset" options in
DayIntervalSelectorFieldwith customizable labels
Architectural changes:
- Refactored the main payments page to use Stripe Connect integration via
ConnectPaymentscomponent - Moved custom payment management UI to dedicated item/offer pages
- Improved form UX with better placeholders ("standard" for price IDs, "One time" for interval unset)
The implementation follows established patterns in the codebase for form dialogs, data tables, and page structure, maintaining consistency with existing user management interfaces while extending functionality specifically for payment management scenarios.
Confidence score: 4/5
- This PR is generally safe to merge with some minor concerns around code organization and potential edge cases
- Score reflects solid architectural patterns and thorough validation logic, but some areas need attention for maintainability
- Pay close attention to offer-dialog.tsx for schema definition conflicts and included-item-editor.tsx for import organization
16 files reviewed, 7 comments
apps/dashboard/src/components/form-fields/day-interval-selector-field.tsx
Show resolved
Hide resolved
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/sidebar-layout.tsx
Show resolved
Hide resolved
Review by RecurseML🔍 Review performed on da6f000..4b79dd1 ✨ No bugs found, your code is sparkling clean ✅ Files analyzed, no issues (5)• ⏭️ Files skipped (low suspicion) (11)• |
https://www.loom.com/share/7f61024ffa354850a70779ac7a20c138?sid=b523394b-b243-4bd2-819c-e36ebab1ab92 <!-- Make sure you've read the CONTRIBUTING.md guidelines: https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md --> <!-- ELLIPSIS_HIDDEN --> ---- > [!IMPORTANT] > Introduce test mode for payment subscriptions, including database schema updates, new API routes, client-side handling, and comprehensive test coverage. > > - **Database**: > - Add `creationSource` column to `Subscription` model in `schema.prisma` and `migration.sql`. > - Enum `SubscriptionCreationSource` added with values `PURCHASE_PAGE` and `TEST_MODE`. > - **API**: > - New route `test-mode-purchase-session` in `route.tsx` for handling test mode purchases. > - Modify `purchase-session` and `validate-code` routes to support test mode. > - **Client**: > - Update `page-client.tsx` to handle test mode bypass and display relevant UI elements. > - Add `handleBypass` function to simulate test mode purchases. > - **Testing**: > - Add tests in `purchase-session.test.ts` and `validate-code.test.ts` for test mode scenarios. > - **Misc**: > - Update `admin-interface.ts` and `admin-app.ts` to include `testModePurchase` function. > - Minor updates to `tailwind.config.ts` for animations. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup> for fd52134. You can [customize](https://app.ellipsis.dev/stack-auth/settings/summaries) this summary. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN -->
(https://www.loom.com/share/ab23e3ed0dde44bcb791d30b3b012777?sid=2ee6dcb4-feca-4d0f-9c8d-1ae9d71ba8f7)
Important
Adds management pages for payment offers and items with create, edit, and delete functionalities, and updates schemas for default values and validation.
page-client.tsxandpage.tsxfor bothitemsandoffersunderpaymentsto manage payment items and offers.DialogOpenerinpage-client.tsxfor creating new items and offers.payment-item-table.tsxandpayment-offer-table.tsx.ensureOfferIdOrInlineOfferinpayments.tsxto defaultquantityto 0 if undefined.branchPaymentsSchemainschema.tsto set defaultquantityto 0 for items.offerSchemaandinlineOfferSchemainschema-fields.tsto definequantityas required.ItemDialogandOfferDialogfor item and offer creation/editing.DialogOpenercomponent for handling dialog state.DayIntervalSelectorFieldto include an unset label option.sidebar-layout.tsxwith feature flag checks.This description was created by
for c22bf3c. You can customize this summary. It will automatically update as commits are pushed.