Skip to content

feat: add product recommendation rule helpers - #307

Merged
paulofph merged 4 commits into
mainfrom
feat/product-recommendation-rules
Nov 20, 2026
Merged

paulofph merged 4 commits into
mainfrom
feat/product-recommendation-rules

Conversation

@paulofph

@paulofph paulofph commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Helpers for the tariff change rule table on product_recommendation, used by the 360 UI and targeting-api when saving.

  • validateProductRecommendationRules(rules): returns the problems of a table ([] = valid). Codes: RULES_REQUIRED, RULE_SOURCE_REQUIRED, DUPLICATE_SOURCE, MULTIPLE_FALLBACKS, OFFERS_REQUIRED, OFFER_IS_OWN_SOURCE, DUPLICATE_RULE_ID.
  • extractProductRecommendationRuleRelations(rules): returns the source_products, source_prices, offer_products and offer_prices relations, de-duplicated (like extractPricingEntitiesBySlug for line items).
  • Rule types come from @epilot/sdk/pricing.

Generated by Claude Code

Add extractProductRecommendationRuleRelations and
validateProductRecommendationRules with ProductRecommendationRule types,
so 360 and targeting-api derive source/offer relations and validate the
rule table of a product_recommendation entity the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012h2oEFg2vbGeGsCBZspGn4
@changeset-bot

changeset-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 34465aa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@epilot/pricing Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

ProductRecommendationOfferItem and ProductRecommendationOfferGroup are now
derived from `Offer` in @epilot/sdk/pricing (the pricing API's spec), so
highlight_config is typed as OfferHighlightConfig. Only the rule itself and
the offer group id are new.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012h2oEFg2vbGeGsCBZspGn4
2.20.114 ships the corrected OfferHighlightConfig (total.format is
'absolute' | 'percentage'), which the product recommendation offer types
now reuse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012h2oEFg2vbGeGsCBZspGn4
@epilot/sdk 2.20.115 ships ProductRecommendationRule and
ProductRecommendationOfferGroup from the pricing API spec. Re-export them
instead of declaring them here, and require @epilot/sdk ^2.20.115.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012h2oEFg2vbGeGsCBZspGn4
@paulofph
paulofph marked this pull request as ready for review November 17, 2026 18:08

@alexmarqs alexmarqs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm!

@paulofph
paulofph merged commit 033d92c into main Nov 20, 2026
3 checks passed
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.

3 participants