Skip to content

show unique features only#2139

Merged
mosch merged 1 commit intomainfrom
only-show-unique
Mar 10, 2026
Merged

show unique features only#2139
mosch merged 1 commit intomainfrom
only-show-unique

Conversation

@mosch
Copy link
Contributor

@mosch mosch commented Mar 10, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 10, 2026 12:08
@vercel
Copy link

vercel bot commented Mar 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zudoku-cosmo-cargo Ready Ready Preview, Comment Mar 10, 2026 1:59pm
zudoku-dev Ready Ready Preview, Comment Mar 10, 2026 1:59pm

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 PricingCard to render per-phase quota/feature sections and hide items duplicated in later phases.
  • Refine tiered overage detection to ignore zero-priced unit tiers.
  • Update formatPrice to 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.

Comment on lines +5 to +6
minimumFractionDigits: Number.isInteger(amount) ? 0 : 2,
maximumFractionDigits: 2,
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
const price = getPriceFromPlan(plan);
const isFree = price.monthly === 0;

const isCustom = plan.metadata?.isCustom === true;
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
const isCustom = plan.metadata?.isCustom === true;
const isCustom =
plan.metadata?.isCustom === true || plan.metadata?.isCustom === "true";

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +25
const overageTier = rc.price.tiers.find(
(t) => t.unitPrice?.amount && parseFloat(t.unitPrice.amount) > 0,
);
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Comment on lines +123 to +130
{plan.phases.map((phase, index) => {
const laterKeys = new Set(
plan.phases
.slice(index + 1)
.flatMap((p) =>
p.rateCards.map((rc) => rc.featureKey ?? rc.key),
),
);
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

github-actions bot commented Mar 10, 2026

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

@mosch mosch force-pushed the only-show-unique branch from dafa78a to 95ae03d Compare March 10, 2026 13:57
@mosch mosch enabled auto-merge (squash) March 10, 2026 13:59
@mosch mosch merged commit 0e03921 into main Mar 10, 2026
12 checks passed
@mosch mosch deleted the only-show-unique branch March 10, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Will not appear in generated release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants