@metron-labs/quote-react 0.1.23 → 0.1.25
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.
package/dist/app/QuickQuote.js
CHANGED
|
@@ -33,6 +33,10 @@ function QuickQuoteInner({ fullPage = false, hideHeader = false, internal = fals
|
|
|
33
33
|
track("viewed");
|
|
34
34
|
}, [track]);
|
|
35
35
|
useEffect(() => {
|
|
36
|
+
for (const item of Object.values(cart)) {
|
|
37
|
+
if (getPricingBreakdown(item).requiredSellUnits != null)
|
|
38
|
+
resolvedConversionInputs.current.delete(item.lineId);
|
|
39
|
+
}
|
|
36
40
|
const unresolved = Object.values(cart).filter((item) => {
|
|
37
41
|
if (item.productId === "-" || getPricingBreakdown(item).requiredSellUnits != null)
|
|
38
42
|
return false;
|
|
@@ -56,6 +56,10 @@ export default function BasketStage({ cart, onUpdateQty, onUpdateSellUnits, onRe
|
|
|
56
56
|
useEffect(() => {
|
|
57
57
|
if (!onResolveConversions)
|
|
58
58
|
return;
|
|
59
|
+
for (const item of Object.values(cart)) {
|
|
60
|
+
if (getPricingBreakdown(item).requiredSellUnits != null)
|
|
61
|
+
resolvedProductIds.current.delete(item.lineId);
|
|
62
|
+
}
|
|
59
63
|
const unresolved = Object.values(cart).filter((item) => item.productId !== "-" && getPricingBreakdown(item).requiredSellUnits == null && !resolvedProductIds.current.has(item.lineId));
|
|
60
64
|
if (unresolved.length === 0)
|
|
61
65
|
return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CartItem, LineItem, MatchCandidate, ScheduleResult } from "../../util/types";
|
|
1
|
+
import type { CartItem, LineItem, MatchCandidate, MatchResult, ScheduleResult } from "../../util/types";
|
|
2
2
|
interface ResultsStageProps {
|
|
3
3
|
scheduleResult: ScheduleResult;
|
|
4
4
|
onStartOver: () => void;
|
|
@@ -12,6 +12,7 @@ interface ResultsStageProps {
|
|
|
12
12
|
onReviewGateComplete: () => void;
|
|
13
13
|
internal?: boolean;
|
|
14
14
|
}
|
|
15
|
+
export declare function resolveBest(result: MatchResult | undefined, overriddenProductId: string | undefined): MatchCandidate | undefined;
|
|
15
16
|
export declare function candidateFromCart(item: CartItem): MatchCandidate;
|
|
16
17
|
export declare function refreshedCartItem(refreshed: CartItem, existing: CartItem): CartItem;
|
|
17
18
|
export declare function displayLineLabel(item: LineItem, allItems: LineItem[]): string;
|
|
@@ -31,7 +31,7 @@ function confidenceLabel(band) {
|
|
|
31
31
|
return band === "high" ? "High" : band === "medium" ? "Medium" : "Low";
|
|
32
32
|
}
|
|
33
33
|
const isUnmatchable = (item) => item.attrs.supply_nature === "labour_only" || item.attrs.supply_nature === "plant" || item.flags.includes("referential");
|
|
34
|
-
function resolveBest(result, overriddenProductId) {
|
|
34
|
+
export function resolveBest(result, overriddenProductId) {
|
|
35
35
|
if (overriddenProductId === NO_SELECTION)
|
|
36
36
|
return undefined;
|
|
37
37
|
if (overriddenProductId)
|
|
@@ -39,10 +39,7 @@ function resolveBest(result, overriddenProductId) {
|
|
|
39
39
|
if (result?.decision?.selected_candidate_id != null) {
|
|
40
40
|
return result.candidates.find((c) => c.product_id === result.decision.selected_candidate_id);
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
|
-
return result?.candidates?.[0];
|
|
42
|
+
return undefined;
|
|
46
43
|
}
|
|
47
44
|
// Results unmount while the basket is open. A manual pick is already retained in the
|
|
48
45
|
// cart, so rebuild just enough candidate data from that source when returning.
|