Kaizen
Browse modulesPricingpricing/sharedTypes

Type Alias: PricingEvaluationResult<TContext *extends* [`EvaluatePricingContext`](EvaluatePricingContext.md)>

type PricingEvaluationResult<TContext extends EvaluatePricingContext> = {
  calculation?: PricingCalculation<TContext["line_items"][number]>;
  conditionsTable?: Record<string, Condition>;
  context: TContext;
  matched: MatchedPricingRule[];
  matchedByLevel: Record<PricingLevel, MatchedPricingRule[]>;
  matchedByLineItem: MatchedPricingLineItem<TContext["line_items"][number]>[];
  matchedByPhase: Record<PricingCalculationPhase, MatchedPricingRule[]>;
  scoped: Rule[];
};

Defined in: shared/pricing/types/results.ts:34

Type Parameters

Type Parameter
TContext extends EvaluatePricingContext

Properties

calculation?

optional calculation?: PricingCalculation<TContext["line_items"][number]>;

Defined in: shared/pricing/types/results.ts:68

Subtotals and the ordered, per-action breakdown produced by calculatePrices. Optional because partitionPricingResult alone (without calculatePrices) doesn't emit it — callers that bypass evaluatePricing and want totals should run calculatePrices on the partitioned result themselves.


conditionsTable?

optional conditionsTable?: Record<string, Condition>;

Defined in: shared/pricing/types/results.ts:47

The conditions table the engine consulted while matching, indexed by condition.id. Populated when evaluatePricing runs the qualify pass; direct callers of partitionPricingResult who want per-sub-unit qualification must supply this themselves. Absent for pre-qualification flows.


context

context: TContext;

Defined in: shared/pricing/types/results.ts:35


matched

matched: MatchedPricingRule[];

Defined in: shared/pricing/types/results.ts:38


matchedByLevel

matchedByLevel: Record<PricingLevel, MatchedPricingRule[]>;

Defined in: shared/pricing/types/results.ts:49


matchedByLineItem

matchedByLineItem: MatchedPricingLineItem<TContext["line_items"][number]>[];

Defined in: shared/pricing/types/results.ts:59

Per-line-item attachment of matched line-level rules. Only rules with domain_config.level === "line" are considered; for each line item we re-run scope matching and evaluate line-item condition leaves against that line while preserving full-cart context for aggregate leaves. Order-level rules are not included here — see matchedByLevel.order.


matchedByPhase

matchedByPhase: Record<PricingCalculationPhase, MatchedPricingRule[]>;

Defined in: shared/pricing/types/results.ts:50


scoped

scoped: Rule[];

Defined in: shared/pricing/types/results.ts:37

On this page