@metron-labs/quote-react 0.1.66 → 0.1.68
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/LICENSE +31 -31
- package/README.md +253 -253
- package/dist/app/EstimatingTools.js +5 -5
- package/dist/app/QuickQuote.js +7 -7
- package/dist/app/stages/BasketStage.js +10 -19
- package/dist/app/stages/EntryStage.js +5 -5
- package/dist/app/stages/ScheduleResultsStage.js +8 -9
- package/dist/components/estimators/ArchitraveEstimator.js +1 -1
- package/dist/components/estimators/DeckingEstimator.js +2 -2
- package/dist/components/estimators/EstimatorResults.d.ts +1 -1
- package/dist/components/estimators/EstimatorResults.js +6 -6
- package/dist/components/estimators/EstimatorReviewStage.d.ts +1 -1
- package/dist/components/estimators/EstimatorReviewStage.js +1 -1
- package/dist/components/estimators/FencingEstimator.js +2 -2
- package/dist/components/estimators/PaintEstimator.js +1 -1
- package/dist/components/estimators/RoofTrussEstimator.js +1 -1
- package/dist/components/estimators/registry.d.ts +1 -1
- package/dist/components/estimators/useFixedBasket.js +3 -3
- package/dist/embed/quote.js +6964 -6964
- package/dist/index.d.ts +5 -5
- package/dist/index.js +3 -3
- package/dist/styles.css +6961 -6961
- package/dist/{lib → util}/api/fetchSchedule.d.ts +1 -1
- package/dist/{lib → util}/cart/CartContext.d.ts +1 -2
- package/dist/{lib/boq → util/cart}/toCartItem.d.ts +1 -1
- package/dist/{lib → util}/estimators/requestUnit.d.ts +1 -1
- package/dist/{lib → util}/estimators/resolveProducts.d.ts +1 -1
- package/dist/util/exportScheduleExcel.js +17 -3
- package/dist/util/pricing.js +1 -1
- package/dist/util/types.d.ts +0 -1
- package/package.json +53 -53
- /package/dist/{app/components → components/unit}/UnitDisplay.d.ts +0 -0
- /package/dist/{app/components → components/unit}/UnitDisplay.js +0 -0
- /package/dist/{app/components → components/unit}/UnitLabel.d.ts +0 -0
- /package/dist/{app/components → components/unit}/UnitLabel.js +0 -0
- /package/dist/{lib → util}/ProductImage.d.ts +0 -0
- /package/dist/{lib → util}/ProductImage.js +0 -0
- /package/dist/{lib → util}/QuoteProvider.d.ts +0 -0
- /package/dist/{lib → util}/QuoteProvider.js +0 -0
- /package/dist/{lib → util}/analytics.d.ts +0 -0
- /package/dist/{lib → util}/analytics.js +0 -0
- /package/dist/{lib → util}/api/boqClient.d.ts +0 -0
- /package/dist/{lib → util}/api/boqClient.js +0 -0
- /package/dist/{lib → util}/api/boqSession.d.ts +0 -0
- /package/dist/{lib → util}/api/boqSession.js +0 -0
- /package/dist/{lib → util}/api/fetchSchedule.js +0 -0
- /package/dist/{lib → util}/api/pollJob.d.ts +0 -0
- /package/dist/{lib → util}/api/pollJob.js +0 -0
- /package/dist/{lib → util}/assets.d.ts +0 -0
- /package/dist/{lib → util}/assets.js +0 -0
- /package/dist/{lib → util}/cart/CartContext.js +0 -0
- /package/dist/{lib/boq → util/cart}/toCartItem.js +0 -0
- /package/dist/{lib → util}/config.d.ts +0 -0
- /package/dist/{lib → util}/config.js +0 -0
- /package/dist/{lib → util}/estimators/fixedProducts.d.ts +0 -0
- /package/dist/{lib → util}/estimators/fixedProducts.js +0 -0
- /package/dist/{lib → util}/estimators/requestUnit.js +0 -0
- /package/dist/{lib → util}/estimators/resolveProducts.js +0 -0
- /package/dist/{lib → util}/estimators/types.d.ts +0 -0
- /package/dist/{lib → util}/estimators/types.js +0 -0
- /package/dist/{lib → util}/formatters.d.ts +0 -0
- /package/dist/{lib → util}/formatters.js +0 -0
- /package/dist/{lib/boq → util}/inputLimits.d.ts +0 -0
- /package/dist/{lib/boq → util}/inputLimits.js +0 -0
- /package/dist/{lib → util}/quoteHistory.d.ts +0 -0
- /package/dist/{lib → util}/quoteHistory.js +0 -0
- /package/dist/{lib → util}/useEscapeKey.d.ts +0 -0
- /package/dist/{lib → util}/useEscapeKey.js +0 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useId, useRef, useState } from "react";
|
|
3
|
-
import { apiUrl } from "../../
|
|
4
|
-
import { useTrack } from "../../
|
|
5
|
-
import { fmtCurrency } from "../../
|
|
3
|
+
import { apiUrl } from "../../util/config";
|
|
4
|
+
import { useTrack } from "../../util/analytics";
|
|
5
|
+
import { fmtCurrency } from "../../util/formatters";
|
|
6
6
|
import { getCartSubtotal, getPricingBreakdown } from "../../util/pricing";
|
|
7
7
|
import { exportBasketExcel } from "../../util/exportScheduleExcel";
|
|
8
|
-
import { renderDisplayUnit, unitDisplayText } from "
|
|
9
|
-
import { clientHeaders, getBoqClientId, readJson } from "../../
|
|
10
|
-
import { MAX_ORDER_QTY } from "../../
|
|
11
|
-
import { conversionInputKey } from "../../
|
|
8
|
+
import { renderDisplayUnit, unitDisplayText } from "../../components/unit/UnitDisplay";
|
|
9
|
+
import { clientHeaders, getBoqClientId, readJson } from "../../util/api/boqClient";
|
|
10
|
+
import { MAX_ORDER_QTY } from "../../util/inputLimits";
|
|
11
|
+
import { conversionInputKey } from "../../util/cart/CartContext";
|
|
12
12
|
import BackArrow from "../../components/BackArrow";
|
|
13
13
|
import ChevronIcon from "../../components/ChevronIcon";
|
|
14
14
|
import TrashIcon from "../../components/TrashIcon";
|
|
15
|
-
import ProductImage from "../../
|
|
15
|
+
import ProductImage from "../../util/ProductImage";
|
|
16
16
|
const VAT_RATE = 0.2; //Flat UK VAT rate, matching fmtCurrency's GBP-only assumption elsewhere in this app.
|
|
17
17
|
const PAGE_SIZE = 10;
|
|
18
18
|
const INVALID_EMAIL_MESSAGE = "Enter a valid email address so we can send your quote.";
|
|
@@ -107,20 +107,11 @@ export default function BasketStage({ cart, onUpdateQty, onUpdateSellUnits, onRe
|
|
|
107
107
|
const conversion = resolved?.conversion;
|
|
108
108
|
if (!conversion || typeof resolved?.line_id !== "string" || resolvedConversionInputs.current.get(resolved.line_id) !== inputByLineId.get(resolved.line_id))
|
|
109
109
|
continue;
|
|
110
|
-
const current = cart[resolved.line_id];
|
|
111
110
|
updates[resolved.line_id] = {
|
|
112
|
-
conversionType: conversion.conversion_type,
|
|
113
|
-
requestUomsSupported: conversion.request_uoms_supported,
|
|
114
|
-
salesUomNormalised: conversion.sales_uom_normalised,
|
|
115
|
-
salesUnitSize: conversion.sales_unit_size,
|
|
116
|
-
salesUnitSizeUom: conversion.sales_unit_size_uom,
|
|
117
|
-
coverageQty: conversion.coverage_qty,
|
|
118
|
-
coverageUom: conversion.coverage_uom,
|
|
119
|
-
roundingRule: conversion.rounding_rule,
|
|
120
111
|
conversionConfidence: conversion.conversion_confidence,
|
|
121
112
|
conversionNotes: conversion.conversion_notes,
|
|
122
|
-
...(
|
|
123
|
-
? {
|
|
113
|
+
...(Number.isFinite(conversion.suggested_order_qty) && conversion.suggested_order_qty > 0
|
|
114
|
+
? { sellUnitsOverride: conversion.suggested_order_qty }
|
|
124
115
|
: {}),
|
|
125
116
|
};
|
|
126
117
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { assetUrl } from "../../
|
|
4
|
-
import { useTrack } from "../../
|
|
5
|
-
import { FILE_EXTENSIONS, isPhotoFile, shrinkPhoto, validateLines, validateUploadFile } from "../../
|
|
3
|
+
import { assetUrl } from "../../util/assets";
|
|
4
|
+
import { useTrack } from "../../util/analytics";
|
|
5
|
+
import { FILE_EXTENSIONS, isPhotoFile, shrinkPhoto, validateLines, validateUploadFile } from "../../util/inputLimits";
|
|
6
6
|
import { ProcessingContent } from "./ProcessingStage";
|
|
7
|
-
import { useEscapeKey } from "../../
|
|
8
|
-
import { setStep, stepBack } from "../../
|
|
7
|
+
import { useEscapeKey } from "../../util/useEscapeKey";
|
|
8
|
+
import { setStep, stepBack } from "../../util/quoteHistory";
|
|
9
9
|
import ForwardArrow from "../../components/ForwardArrow";
|
|
10
10
|
import CloseIcon from "../../components/CloseIcon";
|
|
11
11
|
const UPLOAD_ACCEPT = [...FILE_EXTENSIONS.schedule, ...FILE_EXTENSIONS.photo].join(",");
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment, useEffect, useRef, useState } from "react";
|
|
3
|
-
import { apiUrl, getQuoteConfig } from "../../
|
|
4
|
-
import { useTrack } from "../../
|
|
5
|
-
import { renderDisplayUnit, formatPriceBasis } from "
|
|
6
|
-
import { fmtCurrency, fmtQty } from "../../
|
|
7
|
-
import { candidateToCartItem } from "../../
|
|
8
|
-
import { apiHeaders, getBoqClientId, readJson } from "../../
|
|
3
|
+
import { apiUrl, getQuoteConfig } from "../../util/config";
|
|
4
|
+
import { useTrack } from "../../util/analytics";
|
|
5
|
+
import { renderDisplayUnit, formatPriceBasis } from "../../components/unit/UnitDisplay";
|
|
6
|
+
import { fmtCurrency, fmtQty } from "../../util/formatters";
|
|
7
|
+
import { candidateToCartItem } from "../../util/cart/toCartItem";
|
|
8
|
+
import { apiHeaders, getBoqClientId, readJson } from "../../util/api/boqClient";
|
|
9
9
|
import { exportScheduleExcel } from "../../util/exportScheduleExcel";
|
|
10
|
-
import { useEscapeKey } from "../../
|
|
10
|
+
import { useEscapeKey } from "../../util/useEscapeKey";
|
|
11
11
|
import { getCartSubtotal, getPricingBreakdown } from "../../util/pricing";
|
|
12
12
|
import BackArrow from "../../components/BackArrow";
|
|
13
13
|
import RefreshIcon from "../../components/RefreshIcon";
|
|
14
14
|
import ForwardArrow from "../../components/ForwardArrow";
|
|
15
15
|
import CloseIcon from "../../components/CloseIcon";
|
|
16
|
-
import ProductImage from "../../
|
|
16
|
+
import ProductImage from "../../util/ProductImage";
|
|
17
17
|
const NO_SELECTION = "__none__";
|
|
18
18
|
const PAGE_SIZE = 24;
|
|
19
19
|
const SORT_OPTIONS = [
|
|
@@ -285,7 +285,6 @@ function AdjudicationDebugBlock({ result }) {
|
|
|
285
285
|
const details = [
|
|
286
286
|
["Dependent rerank applied", debug.dependent_rerank_applied ? "yes" : "no"],
|
|
287
287
|
["Linked parent selected product", debug.linked_parent_selected_candidate_description || debug.linked_parent_selected_candidate_id || "-"],
|
|
288
|
-
["Dimension reason overridden", debug.dimension_reason_overridden ? "yes" : "no"],
|
|
289
288
|
];
|
|
290
289
|
return (_jsxs("div", { className: "results-detail-block", children: [_jsx("h4", { style: { margin: "0 0 12px" }, children: "Adjudication context" }), _jsx("dl", { className: "results-detail-grid", children: details.map(([label, value]) => (_jsxs(Fragment, { children: [_jsx("dt", { children: label }), _jsx("dd", { children: value })] }, label))) }), debug.rerank_line_item_input ? (_jsxs(_Fragment, { children: [_jsx("h5", { style: { margin: "12px 0 8px" }, children: "Rerank input" }), _jsx("pre", { className: "results-pre", children: JSON.stringify(debug.rerank_line_item_input, null, 2) })] })) : null] }));
|
|
291
290
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import { offersOption } from "../../
|
|
4
|
+
import { offersOption } from "../../util/estimators/fixedProducts";
|
|
5
5
|
const PROFILES = [
|
|
6
6
|
{ id: "ogee", label: "Ogee", blurb: "Traditional curved profile" },
|
|
7
7
|
{ id: "torus", label: "Torus", blurb: "Soft rounded detail" },
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useRef, useState } from "react";
|
|
4
|
-
import { assetUrl } from "../../
|
|
5
|
-
import { offersOption } from "../../
|
|
4
|
+
import { assetUrl } from "../../util/assets";
|
|
5
|
+
import { offersOption } from "../../util/estimators/fixedProducts";
|
|
6
6
|
import ForwardArrow from "../ForwardArrow";
|
|
7
7
|
const CANVAS_WIDTH_M = 12;
|
|
8
8
|
const CANVAS_HEIGHT_M = 8;
|
|
@@ -4,12 +4,12 @@ import { Fragment, useEffect, useMemo, useRef, useState } from "react";
|
|
|
4
4
|
import BackArrow from "../BackArrow";
|
|
5
5
|
import BrickWall from "../BrickWall";
|
|
6
6
|
import ForwardArrow from "../ForwardArrow";
|
|
7
|
-
import { renderDisplayUnit, formatPriceBasis } from "../../
|
|
8
|
-
import { useOptionalCart } from "../../
|
|
9
|
-
import { candidateToCartItem } from "../../
|
|
10
|
-
import { estimateRequestUnit, fetchCatalogueStatus, resolveRequirements, searchCatalogue } from "../../
|
|
11
|
-
import { fmtCurrency, fmtQty } from "../../
|
|
12
|
-
import ProductImage from "../../
|
|
7
|
+
import { renderDisplayUnit, formatPriceBasis } from "../../components/unit/UnitDisplay";
|
|
8
|
+
import { useOptionalCart } from "../../util/cart/CartContext";
|
|
9
|
+
import { candidateToCartItem } from "../../util/cart/toCartItem";
|
|
10
|
+
import { estimateRequestUnit, fetchCatalogueStatus, resolveRequirements, searchCatalogue } from "../../util/estimators/resolveProducts";
|
|
11
|
+
import { fmtCurrency, fmtQty } from "../../util/formatters";
|
|
12
|
+
import ProductImage from "../../util/ProductImage";
|
|
13
13
|
import { getPricingBreakdown } from "../../util/pricing";
|
|
14
14
|
const SORT_OPTIONS = [
|
|
15
15
|
{ dir: "asc", label: "Description (A-Z)" },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EstimatorToolId } from "./registry";
|
|
2
|
-
import type { EstimatorRequirement } from "../../
|
|
2
|
+
import type { EstimatorRequirement } from "../../util/estimators/types";
|
|
3
3
|
interface EstimatorReviewStageProps {
|
|
4
4
|
toolId: EstimatorToolId;
|
|
5
5
|
toolTitle: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useState } from "react";
|
|
4
4
|
import EstimatorResults from "./EstimatorResults";
|
|
5
|
-
import { fmtCurrency } from "../../
|
|
5
|
+
import { fmtCurrency } from "../../util/formatters";
|
|
6
6
|
/**
|
|
7
7
|
* The product-matching step. Its own screen between the calculator and the basket,
|
|
8
8
|
* mirroring the Quick Quote results stage.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useRef, useState } from "react";
|
|
4
|
-
import { assetUrl } from "../../
|
|
5
|
-
import { offersOption } from "../../
|
|
4
|
+
import { assetUrl } from "../../util/assets";
|
|
5
|
+
import { offersOption } from "../../util/estimators/fixedProducts";
|
|
6
6
|
import ForwardArrow from "../ForwardArrow";
|
|
7
7
|
const GRID_SIZE = 12;
|
|
8
8
|
const CELL_PX = 30;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import { fixedProductSearch } from "../../
|
|
4
|
+
import { fixedProductSearch } from "../../util/estimators/fixedProducts";
|
|
5
5
|
const PAINT_COVERAGE_M2_PER_LITRE = 10;
|
|
6
6
|
const DOOR_AREA_M2 = 1.9 * 0.762;
|
|
7
7
|
const DOUBLE_DOOR_AREA_M2 = 1.9 * 1.524;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import ForwardArrow from "../ForwardArrow";
|
|
5
|
-
import { fmtCurrency } from "../../
|
|
5
|
+
import { fmtCurrency } from "../../util/formatters";
|
|
6
6
|
const CONFIG = {
|
|
7
7
|
ranges: {
|
|
8
8
|
standard: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentType } from "react";
|
|
2
|
-
import type { EstimatorRequirement } from "../../
|
|
2
|
+
import type { EstimatorRequirement } from "../../util/estimators/types";
|
|
3
3
|
export type EstimatorToolId = "truss" | "fencing" | "decking" | "brick-block" | "paint" | "skirting" | "architrave" | "concrete-aggregate" | "plasterboard" | "insulation" | "timber" | "paving";
|
|
4
4
|
/** How a merchant thinks about the jobs, not how the components are filed. */
|
|
5
5
|
export type EstimatorGroup = "Structure & Envelope" | "Outdoor" | "Interiors" | "Groundwork";
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import BrickWall from "../BrickWall";
|
|
5
|
-
import { useCart } from "../../
|
|
6
|
-
import { candidateToCartItem } from "../../
|
|
7
|
-
import { estimateRequestUnit, searchCatalogue } from "../../
|
|
5
|
+
import { useCart } from "../../util/cart/CartContext";
|
|
6
|
+
import { candidateToCartItem } from "../../util/cart/toCartItem";
|
|
7
|
+
import { estimateRequestUnit, searchCatalogue } from "../../util/estimators/resolveProducts";
|
|
8
8
|
const MIN_BASKET_LOADING_MS = 1500;
|
|
9
9
|
export function useFixedBasket(toolTitle) {
|
|
10
10
|
const { addManyToCart, clearCart, openBasket } = useCart();
|