@metron-labs/quote-react 0.1.48 → 0.1.50
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.
|
@@ -104,6 +104,7 @@ export default function BasketStage({ cart, onUpdateQty, onUpdateSellUnits, onRe
|
|
|
104
104
|
.then((response) => (response.ok ? readJson(response) : null))
|
|
105
105
|
.then((payload) => {
|
|
106
106
|
const updates = {};
|
|
107
|
+
const inputByLineId = new Map(unresolved.map((item) => [item.lineId, conversionInputKey(item)]));
|
|
107
108
|
for (const resolved of payload?.data?.items ?? payload?.items ?? []) {
|
|
108
109
|
const conversion = resolved?.conversion;
|
|
109
110
|
if (!conversion || typeof resolved?.line_id !== "string" || resolvedConversionInputs.current.get(resolved.line_id) !== inputByLineId.get(resolved.line_id))
|
|
@@ -248,6 +249,12 @@ export default function BasketStage({ cart, onUpdateQty, onUpdateSellUnits, onRe
|
|
|
248
249
|
const total = subtotal == null ? null : subtotal * (1 + VAT_RATE);
|
|
249
250
|
const unpriced = pricedItems.filter(({ pricing }) => pricing.lineTotal == null).length;
|
|
250
251
|
const resolvingCount = Object.keys(resolvingConversionInputs).length;
|
|
252
|
+
const waitingForConversions = !!onResolveConversions && items.some((item) => {
|
|
253
|
+
if (item.productId === "-" || getPricingBreakdown(item).requiredSellUnits != null)
|
|
254
|
+
return false;
|
|
255
|
+
const input = conversionInputKey(item);
|
|
256
|
+
return resolvedConversionInputs.current.get(item.lineId) !== input || resolvingConversionInputs[item.lineId] === input;
|
|
257
|
+
});
|
|
251
258
|
// Once per visit to the basket, with the figures it opened with.
|
|
252
259
|
const openedWith = useRef({ items: pricedItems.length, ...(total == null ? {} : { total: Math.round(total * 100) / 100 }) });
|
|
253
260
|
useEffect(() => {
|
|
@@ -267,7 +274,7 @@ export default function BasketStage({ cart, onUpdateQty, onUpdateSellUnits, onRe
|
|
|
267
274
|
? "Review the items you've added before exporting them for review."
|
|
268
275
|
: qzaBasketLayout
|
|
269
276
|
? "Check your items and quantities below, and we'll do our best to beat list prices."
|
|
270
|
-
: "Review your quantities and order summary before you buy." })] })] }), _jsx("div", { className: "quick-order-panel", style: { paddingTop: 16 }, children: items.length === 0 ? (_jsxs("div", { className: "quick-order-history-empty", children: [_jsx("div", { className: "basket-empty-icon", "aria-hidden": "true", children: "\uD83D\uDCCB" }), _jsx("p", { children: "Your selection is empty." }), _jsx("p", { className: "basket-empty-hint", children: "Go back to your results and add quoted items." }), _jsx("div", { className: "btn-row", style: { marginTop: 20, justifyContent: "center" }, children: _jsx("button", { className: "cta-btn", style: { width: "auto", maxWidth: 280 }, onClick: onBack, "aria-label": "Back to results", children: _jsx("span", { children: "Back to Results" }) }) })] })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "basket-layout", children: [_jsxs("div", { className: "basket-main", children: [_jsx("div", { className: "basket-list", "aria-label": internal ? "Selection items" : qzaBasketLayout ? "Quote request items" : "Basket items", children: pagedItems.map(({ item, pricing }) => {
|
|
277
|
+
: "Review your quantities and order summary before you buy." })] })] }), _jsx("div", { className: "quick-order-panel", style: { paddingTop: 16 }, children: waitingForConversions ? (_jsxs("div", { className: "basket-resolving", role: "status", "aria-label": "Calculating order quantities", children: [_jsx("span", { className: "basket-resolving-wheel", "aria-hidden": "true" }), _jsx("span", { children: "Calculating your quantities\u2026" })] })) : items.length === 0 ? (_jsxs("div", { className: "quick-order-history-empty", children: [_jsx("div", { className: "basket-empty-icon", "aria-hidden": "true", children: "\uD83D\uDCCB" }), _jsx("p", { children: "Your selection is empty." }), _jsx("p", { className: "basket-empty-hint", children: "Go back to your results and add quoted items." }), _jsx("div", { className: "btn-row", style: { marginTop: 20, justifyContent: "center" }, children: _jsx("button", { className: "cta-btn", style: { width: "auto", maxWidth: 280 }, onClick: onBack, "aria-label": "Back to results", children: _jsx("span", { children: "Back to Results" }) }) })] })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "basket-layout", children: [_jsxs("div", { className: "basket-main", children: [_jsx("div", { className: "basket-list", "aria-label": internal ? "Selection items" : qzaBasketLayout ? "Quote request items" : "Basket items", children: pagedItems.map(({ item, pricing }) => {
|
|
271
278
|
const requestedQtyValue = qtyDrafts[item.lineId] ?? String(pricing.requestedAmount);
|
|
272
279
|
const requestedLocked = pricing.requestedUnit === pricing.sellUnit || pricing.costingMode === "review";
|
|
273
280
|
const rawDiffersFromOrder = pricing.requiredSellUnits == null || pricing.requestedAmount !== pricing.requiredSellUnits || pricing.requestedUnit !== pricing.sellUnit;
|