Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Updates the monetization plugin pricing UI and related utilities to better present plan phase details and avoid repeating the same quotas/features across phases, while also refining currency/overage formatting.
Changes:
- Adjust
PricingCardto render per-phase quota/feature sections and hide items duplicated in later phases. - Refine tiered overage detection to ignore zero-priced unit tiers.
- Update
formatPriceto display cents for non-integer amounts.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/plugin-zuplo-monetization/src/utils/formatPrice.ts | Changes currency fraction-digit behavior for formatted prices. |
| packages/plugin-zuplo-monetization/src/utils/categorizeRateCards.ts | Tightens overage-tier selection for tiered pricing. |
| packages/plugin-zuplo-monetization/src/pages/pricing/PricingCard.tsx | Renders phase sections and de-duplicates displayed quotas/features across phases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| minimumFractionDigits: Number.isInteger(amount) ? 0 : 2, | ||
| maximumFractionDigits: 2, |
There was a problem hiding this comment.
formatPrice now forces maximumFractionDigits: 2, which overrides the correct minor-unit digits for many currencies (e.g., JPY should have 0, KWD has 3). This can misrepresent amounts when currency is not USD. Consider using Intl.NumberFormat(...).resolvedOptions().maximumFractionDigits (or omitting max/min overrides) so the formatter follows the currency’s default fraction digits, while still optionally suppressing decimals for whole-number amounts.
| const price = getPriceFromPlan(plan); | ||
| const isFree = price.monthly === 0; | ||
|
|
||
| const isCustom = plan.metadata?.isCustom === true; |
There was a problem hiding this comment.
plan.metadata is typed as Record<string, unknown> and elsewhere in this plugin metadata flags are treated as strings (e.g. zuplo_most_popular === "true"). Checking plan.metadata?.isCustom === true will never match if the API sends string values, so the “Custom / Contact Sales” UI may not appear. Consider checking for a string value (e.g. === "true") and/or falling back to a plan key convention (like the enterprise check used in SwitchPlanModal).
| const isCustom = plan.metadata?.isCustom === true; | |
| const isCustom = | |
| plan.metadata?.isCustom === true || plan.metadata?.isCustom === "true"; |
| const overageTier = rc.price.tiers.find( | ||
| (t) => t.unitPrice?.amount && parseFloat(t.unitPrice.amount) > 0, | ||
| ); |
There was a problem hiding this comment.
The overage-tier selection now explicitly ignores unitPrice.amount values that parse to 0 (parseFloat(...) > 0). There’s existing test coverage for overage pricing, but no test that asserts a 0 unit price is excluded (the new behavior this change introduces). Please add a test case to prevent regressions (e.g., tiers with unitPrice.amount: "0" should not set overagePrice).
| {plan.phases.map((phase, index) => { | ||
| const laterKeys = new Set( | ||
| plan.phases | ||
| .slice(index + 1) | ||
| .flatMap((p) => | ||
| p.rateCards.map((rc) => rc.featureKey ?? rc.key), | ||
| ), | ||
| ); |
There was a problem hiding this comment.
The new phase deduping logic builds laterKeys and filters quotas/features so repeated items only render once across phases. This is a behavior change in the pricing UI, but there’s currently no test exercising multi-phase plans to verify duplicates are hidden/retained as intended. Please add a test (likely in PricingPage.test.tsx) that renders a plan with 2+ phases and asserts a repeated feature/quota only appears once.
|
Preview build of published Zudoku package for commit 95ae03d. See the deployment at: https://7bc89f85.cosmocargo-public-package.pages.dev Note This is a preview of the Cosmo Cargo example using the Zudoku package published to a local registry to ensure it'll be working when published to the public NPM registry. Last updated: 2026-03-10T14:01:37.167Z |
No description provided.