@munchi_oy/promotion-engine
v1.5.14
Published
Munchi Promotion Engine - Pure promotion rule resolution utilities
Readme
@munchi_oy/promotion-engine
Pure promotion rule resolution utilities for Munchi channels.
This package is intended to stay headless and reusable across POS, kiosk, storefront, and other consumers. It should not import React, cart-engine, persistence, network clients, or UI code.
Scope
This package will own:
- normalized promotion resolver input and output types
- condition and rule evaluation
- priority and winner resolution
- automatic promotion application plans
This package will not own:
- channel cart state
- cart mutation
- API fetching
- persistence
- activity logs
- UI rendering
Usage
import { resolvePromotions } from "@munchi_oy/promotion-engine";
const result = resolvePromotions({
discounts: [],
cart,
nowIso: new Date().toISOString(),
timezone: "Europe/Amsterdam",
});Migration note
resolvePromotionsnow returns a flat array of resolved discounts.- Each resolved discount includes:
scope: "cart" | "item"targetProductIds?: string[]
- When
scope === "item", the consumer must expandtargetProductIdsto matchinglineItemIdslocally before applying discounts. - Resolver does not fan out one discount into many records and does not precompute per-line-item amounts.
- If one line item matches multiple product ids from the same resolved discount, consumer should still apply that discount only once per line item.
License
UNLICENSED - Private package
