fix: Align MCP Apps widget pricing with Store page#1101
Open
jirispilka wants to merge 3 commits into
Open
Conversation
Use the primary PAY_PER_EVENT charge event and GOLD-tier pricing in the widget badge so multi-event Actors no longer show a generic "Pay per event" label. Closes #905 Co-authored-by: Cursor <cursoragent@cursor.com>
The initial fix for #905 hardcoded a "prefer GOLD tier" rule for the "from $X / 1,000" badge instead of the true minimum across paid tiers, mismatching actors where a higher tier is cheaper than GOLD. Restore Math.min() semantics, matching the sibling PRICE_PER_DATASET_ITEM formatter in the same file. Also renames the new test file to match this repo's widget.* naming convention and documents isPrimaryEvent in the pricing_info.ts contract.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes MCP Apps widget pricing badges so they match the public Apify Store Actor page, especially for PAY_PER_EVENT Actors with multiple charge events (primary-event selection) and full tier matrices.
Changes:
- Propagate
isPrimaryEventfrom API pricing data through structured/simplified pricing structures and schemas. - Update widget pricing formatting to prefer the primary PPE event and show a
fromprefix for multi-event PPE badges. - Add unit tests covering primary-event selection and a Store-page regression for
xtdata/twitter-x-scraper(#905).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/widget.formatting.test.ts | Adds widget-facing formatting tests for PPE primary-event selection and Store-page regression. |
| tests/unit/utils.pricing_info.test.ts | Verifies isPrimaryEvent is preserved in both complete and simplified structured pricing. |
| src/web/src/utils/formatting.ts | Updates PPE formatting to pick a primary event and optionally prefix with from for multi-event cases. |
| src/web/src/types.ts | Extends web StructuredPricingInfo.events[] with optional isPrimaryEvent. |
| src/utils/pricing_info.ts | Adds isPrimaryEvent to charge-event types and maps it into structured pricing outputs. |
| src/utils/actor_card.ts | Switches widget actor pricing to complete structured pricing (vs simplified) for Store-badge parity. |
| src/tools/structured_output_schemas.ts | Exposes isPrimaryEvent in structured output JSON schema for events. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+118
to
+121
| it('uses the true cheapest tier, not GOLD, when a higher tier is cheaper', () => { | ||
| // compass/crawler-google-places-shaped: price decreases monotonically per tier, | ||
| // DIAMOND ($0.76/1,000) is cheaper than GOLD ($2.10/1,000). | ||
| const price = formatPricing({ |
Comment on lines
63
to
67
| const title = event.title.toLowerCase() || 'result'; | ||
| const prefix = showFromPrefix ? 'from ' : ''; | ||
|
|
||
| if (event.tieredPricing && event.tieredPricing.length > 0) { | ||
| const tieredPrices = event.tieredPricing |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
isPrimaryEvent) instead of the generic "Pay per event" label when an Actor has multiple events.from $0.25 / 1,000 each tweet…forxtdata/twitter-x-scraper).Closes #905
Test plan
formatPricingprimary-event + Store-page regression (tests/unit/web.formatting.pricing.test.ts)isPrimaryEventpassed through complete/simplified structured pricingpnpm run type-check,lint,test:unit,format,check:agentsxtdata/twitter-x-scraperin MCP Apps and confirm badge matches https://apify.com/xtdata/twitter-x-scraperMade with Cursor