-
Notifications
You must be signed in to change notification settings - Fork 10
Support new Polar price types and product benefits #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Support new Polar price types and product benefits #34
Conversation
📝 WalkthroughWalkthroughAdded usage-based pricing support (seat-based and metered unit) and product benefits. Extended product price schema with fields: Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (2)📓 Common learnings📚 Learning: 2025-12-31T13:36:41.603ZApplied to files:
🔇 Additional comments (5)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
src/component/_generated/component.tsis excluded by!**/_generated/**
📒 Files selected for processing (2)
src/component/schema.tssrc/component/util.ts
🔇 Additional comments (5)
src/component/util.ts (4)
64-74: LGTM: basePrice construction is clean and consistent.The refactored approach with a shared basePrice object improves code maintainability. Deriving
recurringIntervalandtypefrom the product level ensures consistency across all price entries.
76-92: LGTM: fixed and custom price type handlers are correct.Both branches properly extend basePrice with their respective type-specific fields, maintaining consistency with the established pattern.
106-115: LGTM: metered_unit price type handler is comprehensive.All relevant metered unit fields are properly mapped, enabling full support for usage-based billing.
119-130: LGTM: Benefits mapping is comprehensive.All benefit fields are properly mapped with appropriate type conversions (dates to ISO strings, nullable fields handled correctly).
src/component/schema.ts (1)
67-80: LGTM: Benefits schema is comprehensive.The benefits schema correctly captures all benefit fields with appropriate types. The use of
v.any()forproperties(line 78) andv.record(v.string(), v.any())formetadata(line 77) is acceptable for flexible metadata fields, though it reduces type safety. This is a common pattern for handling dynamic API responses.
Fixes #33
Adds initial support for usage-based billing and product benefits from the Polar API.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Summary by CodeRabbit
New Features
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.