@metron-labs/quote-react 0.1.29 → 0.1.31
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 +8 -4
- package/dist/app/stages/ScheduleResultsStage.js +13 -2
- package/dist/embed/quote.js +10 -10
- package/dist/lib/cart/CartContext.d.ts +1 -0
- package/dist/lib/cart/CartContext.js +42 -1
- package/dist/util/pricing.js +3 -1
- package/dist/util/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/app/QuickQuote.js
CHANGED
|
@@ -118,10 +118,14 @@ function QuickQuoteInner({ fullPage = false, hideHeader = false, internal = fals
|
|
|
118
118
|
}, [writeQuoteHistory]);
|
|
119
119
|
const backToResults = useCallback(() => {
|
|
120
120
|
const quoteStage = window.history.state?.boqQuoteStage;
|
|
121
|
-
if (quoteStage === "basket")
|
|
122
|
-
window.
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
if (quoteStage === "basket") {
|
|
122
|
+
const url = new URL(window.location.href);
|
|
123
|
+
url.hash = "matched-products";
|
|
124
|
+
window.history.replaceState({ boqQuoteStage: "results" }, "", url);
|
|
125
|
+
setStage("results");
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
setStage(scheduleResult ? "results" : "entry");
|
|
125
129
|
}, [scheduleResult]);
|
|
126
130
|
// Every screen change, forward or back, lands at the top. Runs after the new screen has
|
|
127
131
|
// rendered, so it also wins over the browser restoring the old scroll on history.back().
|
|
@@ -150,7 +150,7 @@ export function displayLineLabel(item, allItems) {
|
|
|
150
150
|
void allItems;
|
|
151
151
|
const original = typeof item.description_original === "string" ? item.description_original.trim() : "";
|
|
152
152
|
const label = typeof item.customer_display_label === "string" ? item.customer_display_label.trim() : "";
|
|
153
|
-
return
|
|
153
|
+
return label || original || "(no description)";
|
|
154
154
|
}
|
|
155
155
|
const LINK_GROUP_BUBBLE_STYLES = [
|
|
156
156
|
{ background: "#fff7ed", borderColor: "#fdba74", color: "#9a3412" },
|
|
@@ -565,7 +565,18 @@ export default function ScheduleResultsStage({ scheduleResult, onStartOver, cart
|
|
|
565
565
|
? lineItems
|
|
566
566
|
.filter((line) => line.linked_group_id === row.item.linked_group_id && line.linked_group_role === "anchor")
|
|
567
567
|
.slice(0, 1)
|
|
568
|
-
.map((anchor) =>
|
|
568
|
+
.map((anchor) => {
|
|
569
|
+
const selectedAnchor = cart[anchor.line_id];
|
|
570
|
+
return {
|
|
571
|
+
line_id: anchor.line_id,
|
|
572
|
+
product_id: selectedAnchor?.productId ?? null,
|
|
573
|
+
measurements_mm: selectedAnchor?.measurementsMm ?? anchor.attrs.measurements_mm,
|
|
574
|
+
description: selectedAnchor?.description ?? anchor.description_original,
|
|
575
|
+
qty: anchor.qty,
|
|
576
|
+
unit: anchor.unit,
|
|
577
|
+
role: "anchor",
|
|
578
|
+
};
|
|
579
|
+
})
|
|
569
580
|
: undefined,
|
|
570
581
|
});
|
|
571
582
|
}
|