Skip to content

feat: surface all Kosik sale types with dynamic pricing UI - #24

Open
GnotAGnoob wants to merge 1 commit into
mainfrom
claude/sales-types-ui-k8lJX
Open

feat: surface all Kosik sale types with dynamic pricing UI#24
GnotAGnoob wants to merge 1 commit into
mainfrom
claude/sales-types-ui-k8lJX

Conversation

@GnotAGnoob

Copy link
Copy Markdown
Owner

Summary

Expose the full set of promotional data Kosik.cz returns and render it in ProductCard, with interactive controls that recompute the effective price based on which sale conditions are met.

Sale types now surfaced

  • Normal salepercentageDiscount + recommendedPrice (strike-through original price, red "-XX%" badge on the image)
  • Action label — free-text promo text from Kosik (actionLabel)
  • Promo labels — styled tags from labels[] (colored by background)
  • Membership / loyaltyloyaltyClubBenefitsPrice with a toggle button to apply it
  • Quantity / bulkcumulativePrices[] tiers shown as a list, the active tier is highlighted based on the selected quantity

Dynamic pricing

The new ProductSales component has a quantity stepper and a "member" toggle. On every change, computeEffectivePrice picks the best per-unit price from the conditions met (base / member / active bulk tier), then shows:

  • applied-discount badges (sale / membership / bulk)
  • updated per-unit and total price
  • total savings versus the base price × quantity

Backend changes

  • Uncommented / added RecommendedPrice, PercentageDiscount, ActionLabel, Labels, LoyaltyClubBenefitsPrice, HasLoyaltyClubBenefitsPrice, CumulativePrices in internal/scraper/kosik/kosikSchema.go.
  • New Sales, SaleLabel, CumulativePrice shared types in internal/scraper/shared/structs.go, populated via extractSales in the Kosik mapper.
  • New salesFields / saleLabel / cumulativePriceFields in the orchestrator response + mapSalesField mapper, reflected in the regenerated Swagger schema and TS client.

Test plan

  • go build ./... succeeds (verified locally)
  • go test ./... passes (verified locally — no test files for touched packages)
  • make swagger regenerates docs/swagger.json without errors
  • bun run build (gen:client + vite build + tsc) succeeds (verified locally)
  • bun run check passes (verified locally)
  • Manually hit POST /api/v1/text/products with a recipe and confirm the response contains a populated sales field for products on promotion
  • Open the UI, search a product on sale, and verify the discount badge, strikethrough, member toggle and bulk-tier highlighting update the displayed price as conditions change

https://claude.ai/code/session_01U4pUeWgKtQLYgPgWgDkfto

Parse and expose the full set of promotional data from Kosik.cz: percentage
discounts, action labels, promo labels, loyalty/membership prices, cumulative
(bulk) pricing tiers, and recommended-price strike-throughs. Propagate the
data through the shared scraper types, orchestrator response, Swagger schema
and generated TS client.

Render the offers in ProductCard with interactive controls (quantity stepper
and member toggle) that recompute the effective unit and total price based on
which sale conditions are met, and display the resulting savings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants