@metron-labs/quote-react 0.1.22 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,7 @@ interface ResultsStageProps {
13
13
  internal?: boolean;
14
14
  }
15
15
  export declare function candidateFromCart(item: CartItem): MatchCandidate;
16
+ export declare function refreshedCartItem(refreshed: CartItem, existing: CartItem): CartItem;
16
17
  export declare function displayLineLabel(item: LineItem, allItems: LineItem[]): string;
17
18
  export default function ScheduleResultsStage({ scheduleResult, onStartOver, cart, onAddToCart, onRemoveFromCart, onGoToBasket, cartSeeded, onCartSeeded, reviewGateComplete, onReviewGateComplete, internal }: ResultsStageProps): import("react").JSX.Element;
18
19
  export {};
@@ -89,6 +89,39 @@ export function candidateFromCart(item) {
89
89
  method: "manual_cart_selection",
90
90
  };
91
91
  }
92
+ export function refreshedCartItem(refreshed, existing) {
93
+ const base = {
94
+ ...refreshed,
95
+ qty: existing.qty,
96
+ sellUnitsOverride: existing.sellUnitsOverride ?? null,
97
+ };
98
+ if (existing.productId !== refreshed.productId || existing.conversionType !== "basket_line_unit")
99
+ return base;
100
+ return {
101
+ ...base,
102
+ saleUnit: existing.saleUnit,
103
+ saleUnitQuantity: existing.saleUnitQuantity,
104
+ unitConversions: existing.unitConversions,
105
+ conversionType: existing.conversionType,
106
+ requestUomsSupported: existing.requestUomsSupported,
107
+ salesUomNormalised: existing.salesUomNormalised,
108
+ salesUnitSize: existing.salesUnitSize,
109
+ salesUnitSizeUom: existing.salesUnitSizeUom,
110
+ coverageQty: existing.coverageQty,
111
+ coverageUom: existing.coverageUom,
112
+ itemsPerPallet: existing.itemsPerPallet,
113
+ itemsPerPack: existing.itemsPerPack,
114
+ itemsPerBox: existing.itemsPerBox,
115
+ itemsPerM2: existing.itemsPerM2,
116
+ wasteFactorDefault: existing.wasteFactorDefault,
117
+ roundingRule: existing.roundingRule,
118
+ derivedCoverageM2: existing.derivedCoverageM2,
119
+ derivedLengthM: existing.derivedLengthM,
120
+ quoteQtyFormulaType: existing.quoteQtyFormulaType,
121
+ conversionConfidence: existing.conversionConfidence,
122
+ conversionNotes: existing.conversionNotes,
123
+ };
124
+ }
92
125
  function classificationLabel(value) {
93
126
  if (!value)
94
127
  return "not stated";
@@ -550,11 +583,7 @@ export default function ScheduleResultsStage({ scheduleResult, onStartOver, cart
550
583
  if (!existing)
551
584
  continue;
552
585
  const refreshed = toCartItem(row);
553
- onAddToCart({
554
- ...refreshed,
555
- qty: existing.qty,
556
- sellUnitsOverride: existing.sellUnitsOverride ?? null,
557
- });
586
+ onAddToCart(refreshedCartItem(refreshed, existing));
558
587
  }
559
588
  // eslint-disable-next-line react-hooks/exhaustive-deps
560
589
  }, [scheduleResult]);